From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] scripts/signrom: remove Python 2 support, add shebang
Date: Tue, 4 Feb 2020 17:02:03 +0100 [thread overview]
Message-ID: <a1940860-ff53-ee17-bb28-bfae85bc4b98@redhat.com> (raw)
In-Reply-To: <20200204160028.16211-1-pbonzini@redhat.com>
On 2/4/20 5:00 PM, Paolo Bonzini wrote:
> Based-on: <20200130163232.10446-1-philmd@redhat.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> 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é <philmd@redhat.com>
Also, applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next
next prev parent reply other threads:[~2020-02-04 16:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 16:00 [PATCH] scripts/signrom: remove Python 2 support, add shebang Paolo Bonzini
2020-02-04 16:02 ` Philippe Mathieu-Daudé [this message]
2020-02-04 16:07 ` Paolo Bonzini
2020-02-04 16:11 ` Philippe Mathieu-Daudé
2020-02-04 16:18 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2020-02-04 15:58 Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a1940860-ff53-ee17-bb28-bfae85bc4b98@redhat.com \
--to=philmd@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).