From e51488c5f8800a52ac5c8da7a31b85cca5cc95d2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 22 May 2014 16:59:16 -0400 Subject: python3 fixes for vgabios and csm builds. Avoid using chr() as this produces unicode strings on python3. Make sure to only use ord() on slices as the python3 bytearray type returns an integer on a non-slice array access. Signed-off-by: Kevin O'Connor --- scripts/buildrom.py | 18 +++++++++++------- scripts/checkrom.py | 20 ++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/buildrom.py b/scripts/buildrom.py index 8ff60e2..0499049 100755 --- a/scripts/buildrom.py +++ b/scripts/buildrom.py @@ -5,7 +5,7 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. -import sys +import sys, struct from python23compat import as_bytes @@ -14,8 +14,11 @@ def alignpos(pos, alignbytes): return (pos + mask) & ~mask def checksum(data): - ords = map(ord, data) - return sum(ords) + if (sys.version_info > (3, 0)): + cksum = sum(data) + else: + cksum = sum(map(ord, data)) + return struct.pack('> 8) - rawdata = subst(rawdata, tableofs+ENTRY_FIELD_OFS, byte1+byte2) + entry_addr = struct.pack('