]> xenbits.xensource.com Git - osstest/seabios.git/commitdiff
scripts: Remove python23compat.py
authorKevin O'Connor <kevin@koconnor.net>
Sun, 19 Dec 2021 06:31:09 +0000 (01:31 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 19 Dec 2021 14:45:04 +0000 (09:45 -0500)
It's simpler to use b"" designations around binary strings than to use
the as_bytes() function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
scripts/buildrom.py
scripts/checkrom.py
scripts/python23compat.py [deleted file]

index 0499049c3fb6392d0acc6c472e4285fc5da4a806..48bfc177d27f1a4eb4984f5d1a1ff12413cceb6e 100755 (executable)
@@ -7,8 +7,6 @@
 
 import sys, struct
 
-from python23compat import as_bytes
-
 def alignpos(pos, alignbytes):
     mask = alignbytes - 1
     return (pos + mask) & ~mask
@@ -31,7 +29,7 @@ def main():
     count = len(data)
 
     # Pad to a 512 byte boundary
-    data += as_bytes("\0") * (alignpos(count, 512) - count)
+    data += b"\0" * (alignpos(count, 512) - count)
     count = len(data)
 
     # Check if a pci header is present
@@ -42,7 +40,7 @@ def main():
 
     # Fill in size field; clear checksum field
     blocks = struct.pack('<B', int(count/512))
-    data = data[:2] + blocks + data[3:6] + as_bytes("\0") + data[7:]
+    data = data[:2] + blocks + data[3:6] + b"\0" + data[7:]
 
     # Checksum rom
     data = data[:6] + checksum(data) + data[7:]
index aced5e2cfb28caf8fd922b337cf3bd1a6eb5bcdf..a5b15a4c2816cffecc99dc9e2da6e3d9f87f2bb6 100755 (executable)
@@ -8,8 +8,6 @@
 import sys, struct
 import layoutrom, buildrom
 
-from python23compat import as_bytes
-
 def subst(data, offset, new):
     return data[:offset] + new + data[offset + len(new):]
 
@@ -88,7 +86,7 @@ def main():
 
     # Write final file
     f = open(outfile, 'wb')
-    f.write((as_bytes("\0") * (finalsize - datasize)) + rawdata)
+    f.write((b"\0" * (finalsize - datasize)) + rawdata)
     f.close()
 
 if __name__ == '__main__':
diff --git a/scripts/python23compat.py b/scripts/python23compat.py
deleted file mode 100644 (file)
index 572b7f1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# Helper code for compatibility of the code with both Python 2 and Python 3
-#
-# Copyright (C) 2014 Johannes Krampf <johannes.krampf@googlemail.com>
-#
-# This file may be distributed under the terms of the GNU GPLv3 license.
-
-import sys
-
-if (sys.version_info > (3, 0)):
-    def as_bytes(str):
-        return bytes(str, "ASCII")
-else:
-    def as_bytes(str):
-        return str