qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] scripts/signrom: remove Python 2 support, add shebang


From: Paolo Bonzini
Subject: Re: [PATCH] scripts/signrom: remove Python 2 support, add shebang
Date: Tue, 4 Feb 2020 17:07:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 04/02/20 17:02, Philippe Mathieu-Daudé wrote:
> On 2/4/20 5:00 PM, Paolo Bonzini wrote:
>> Based-on: <address@hidden>
>> Cc: Philippe Mathieu-Daudé <address@hidden>
>> Signed-off-by: Paolo Bonzini <address@hidden>
>> ---
>>   scripts/signrom.py | 12 ++++--------
>>   1 file changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/scripts/signrom.py b/scripts/signrom.py
>> index 313ee28a17..9be5dab1cf 100644
>> --- a/scripts/signrom.py
>> +++ b/scripts/signrom.py
>> @@ -1,3 +1,5 @@
>> +#!/usr/bin/env python3
>> +
>>   from __future__ import print_function
>>   #
>>   # Option ROM signing utility
>> @@ -44,14 +46,8 @@ fout.write(data)
>>     checksum = 0
>>   for b in data:
>> -    # catch Python 2 vs. 3 differences
>> -    if isinstance(b, int):
>> -        checksum += b
>> -    else:
>> -        checksum += ord(b)
>> -checksum = (256 - checksum) % 256
>> -
>> -# Python 3 no longer allows chr(checksum)
>> +    checksum = (checksum - b) & 255
>> +
>>   fout.write(struct.pack('B', checksum))
>>     fin.close()
>>
> 
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> 
> Also, applied to my python-next tree:
> https://gitlab.com/philmd/qemu/commits/python-next

Oh, good.  So I've unqueued your series on which this is based.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]