[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 43/46] scripts/signrom: remove Python 2 support, add shebang
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 43/46] scripts/signrom: remove Python 2 support, add shebang |
Date: |
Thu, 6 Feb 2020 22:19:33 +0100 |
From: Paolo Bonzini <address@hidden>
Cc: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
scripts/signrom.py | 10 +++-------
1 file changed, 3 insertions(+), 7 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
+ checksum = (checksum - b) & 255
-# Python 3 no longer allows chr(checksum)
fout.write(struct.pack('B', checksum))
fin.close()
--
2.21.1
- [PULL 34/46] tests: Explicit usage of Python 3, (continued)
- [PULL 34/46] tests: Explicit usage of Python 3, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 36/46] scripts/minikconf: Explicit usage of Python 3, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 35/46] scripts: Explicit usage of Python 3 (scripts with __main__), Philippe Mathieu-Daudé, 2020/02/06
- [PULL 37/46] scripts/tracetool: Remove shebang header, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 38/46] tests/acceptance: Remove shebang header, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 39/46] tests/vm: Remove shebang header, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 40/46] tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__), Philippe Mathieu-Daudé, 2020/02/06
- [PULL 41/46] scripts: Explicit usage of Python 3 (scripts without __main__), Philippe Mathieu-Daudé, 2020/02/06
- [PULL 42/46] tests/qemu-iotests/check: Only check for Python 3 interpreter, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 44/46] make all Python scripts executable, Philippe Mathieu-Daudé, 2020/02/06
- [PULL 43/46] scripts/signrom: remove Python 2 support, add shebang,
Philippe Mathieu-Daudé <=
- [PULL 45/46] drop "from __future__ import print_function", Philippe Mathieu-Daudé, 2020/02/06
- [PULL 46/46] .readthedocs.yml: specify some minimum python requirements, Philippe Mathieu-Daudé, 2020/02/06
- Re: [PULL 00/46] Python queue 2020-02-06, Eduardo Habkost, 2020/02/06
- Re: [PULL 00/46] Python queue 2020-02-06, Peter Maydell, 2020/02/07