Python3 fixes
This commit is contained in:
9
build.py
9
build.py
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/env python3
|
||||||
import os, sys, shutil, re, textwrap
|
import os, sys, shutil, re, textwrap
|
||||||
|
|
||||||
COMPILER = "i586-pc-msdosdjgpp-gcc"
|
COMPILER = "i586-pc-msdosdjgpp-gcc"
|
||||||
@@ -28,7 +28,7 @@ def make_c_include(name, data):
|
|||||||
name = re.sub("[^a-z0-9]", "_", name.lower())
|
name = re.sub("[^a-z0-9]", "_", name.lower())
|
||||||
res = "static const char " + name + "[] = {"
|
res = "static const char " + name + "[] = {"
|
||||||
for c in data:
|
for c in data:
|
||||||
res += str(ord(c)) + ", "
|
res += str(c) + ", "
|
||||||
res = res.rstrip(", ") + "};"
|
res = res.rstrip(", ") + "};"
|
||||||
return name, textwrap.fill(res, width=79)
|
return name, textwrap.fill(res, width=79)
|
||||||
|
|
||||||
@@ -46,8 +46,9 @@ def main():
|
|||||||
|
|
||||||
for filename in embedded_files:
|
for filename in embedded_files:
|
||||||
name = os.path.basename(filename)
|
name = os.path.basename(filename)
|
||||||
name, text = make_c_include(name, open(filename).read())
|
print(f"filename: {filename}")
|
||||||
open("%s/%s.h" % (TEMPSRC_DIR, name), "wb").write(text)
|
name, text = make_c_include(name, open(filename, "rb").read())
|
||||||
|
open("%s/%s.h" % (TEMPSRC_DIR, name), "wb").write(text.encode())
|
||||||
|
|
||||||
cfiles = filter(lambda x: x.endswith((".c", ".C")), listdir(SRC_DIR))
|
cfiles = filter(lambda x: x.endswith((".c", ".C")), listdir(SRC_DIR))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user