summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-12-19 01:31:09 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-12-19 09:45:04 -0500
commit6a62e0cb0dfe9cd28b70547dbea5caf76847c3a9 (patch)
tree3f2d9e984dbe94b58e90bfdc37e61fbd38e624c9 /scripts
parent9ad4399b0e13c84cd6680a8ea6896d7133519995 (diff)
downloadqemu-seabios-6a62e0cb0dfe9cd28b70547dbea5caf76847c3a9.tar.gz
scripts: Remove python23compat.py
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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/buildrom.py6
-rwxr-xr-xscripts/checkrom.py4
-rw-r--r--scripts/python23compat.py14
3 files changed, 3 insertions, 21 deletions
diff --git a/scripts/buildrom.py b/scripts/buildrom.py
index 0499049..48bfc17 100755
--- a/scripts/buildrom.py
+++ b/scripts/buildrom.py
@@ -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:]
diff --git a/scripts/checkrom.py b/scripts/checkrom.py
index aced5e2..a5b15a4 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -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
index 572b7f1..0000000
--- a/scripts/python23compat.py
+++ /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