ECC-1159: Windows: MEMFS option does not work (tested with Python 3)

This commit is contained in:
Shahram Najm 2020-10-20 16:03:43 +01:00
commit 04f9599862
1 changed files with 7 additions and 7 deletions

View File

@ -61,8 +61,6 @@ for directory in dirs:
for dirpath, dirnames, files in os.walk(directory, followlinks=True):
# Prune the walk by modifying the dirnames in-place
dirnames[:] = [dirname for dirname in dirnames if dirname not in EXCLUDED]
for name in files:
@ -90,7 +88,8 @@ for directory in dirs:
FILES[name] = fname
SIZES[name] = os.path.getsize(full)
buffer.write("const unsigned char %s[] = {" % (name,))
txt = "const unsigned char %s[] = {" % (name,)
buffer.write(txt.encode())
with open(full, "rb") as f:
i = 0
@ -104,16 +103,18 @@ 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,))
txt = "0x%s," % (twoChars,)
buffer.write(txt.encode())
i += 1
if (i % 20) == 0:
buffer.write("\n")
buffer.write("\n".encode())
buffer.write("};\n")
buffer.write("};\n".encode())
if buffer.tell() >= CHUNK:
buffer.close()
buffer = None
if buffer is not None:
buffer.close()
@ -317,4 +318,3 @@ FILE* codes_memfs_open(const char* path) {
print("Finished")
print("MEMFS: done", time.time() - start)