Python3 support

This commit is contained in:
Baudouin Raoult 2020-10-21 13:00:00 +01:00
parent 0bbb6bdb63
commit 5bf298f4b2
1 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@ for directory in dirs:
FILES[name] = fname
SIZES[name] = os.path.getsize(full)
buffer.write("const unsigned char %s[] = {" % (name,))
buffer.write(b"const unsigned char %s[] = {" % (name,))
with open(full, "rb") as f:
i = 0
@ -109,12 +109,12 @@ for directory in dirs:
# e.g. 23 -> 0x23
for n in range(0, len(contents_hex), 2):
twoChars = ascii(contents_hex[n : n + 2])
buffer.write("0x%s," % (twoChars,))
buffer.write(b"0x%s," % (twoChars,))
i += 1
if (i % 20) == 0:
buffer.write("\n")
buffer.write(b"\n")
buffer.write("};\n")
buffer.write(b"};\n")
if buffer.tell() >= CHUNK:
buffer.close()
buffer = None