Python build compatible on both python 2 and 3
This commit is contained in:
@@ -29,17 +29,18 @@ except IOError:
|
|||||||
sys.stderr.write("Couldn't open " + src)
|
sys.stderr.write("Couldn't open " + src)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
width = 16;
|
||||||
sys.stdout.write("unsigned char builtins_bitcode_" + target + "[] = {\n")
|
sys.stdout.write("unsigned char builtins_bitcode_" + target + "[] = {\n")
|
||||||
num = 0
|
|
||||||
for line in as_out.stdout.readlines():
|
data = as_out.stdout.read()
|
||||||
length = length + len(line)
|
for i in range(0, len(data), 1):
|
||||||
for c in line:
|
sys.stdout.write("0x%0.2X, " % ord(data[i:i+1]))
|
||||||
num+=1
|
|
||||||
sys.stdout.write("0x%0.2X, " % ord(c))
|
if i%width == (width-1):
|
||||||
if num%16 == 0:
|
sys.stdout.write("\n")
|
||||||
sys.stdout.write("\n");
|
|
||||||
sys.stdout.write(" 0 };\n\n")
|
sys.stdout.write("0x00 };\n\n")
|
||||||
sys.stdout.write("int builtins_bitcode_" + target + "_length = " + str(length) + ";\n")
|
sys.stdout.write("int builtins_bitcode_" + target + "_length = " + str(i) + ";\n")
|
||||||
|
|
||||||
as_out.wait()
|
as_out.wait()
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ t=str(sys.argv[1])
|
|||||||
|
|
||||||
sys.stdout.write("char stdlib_" + t + "_code[] = {\n")
|
sys.stdout.write("char stdlib_" + t + "_code[] = {\n")
|
||||||
|
|
||||||
num = 0
|
width = 16
|
||||||
for line in sys.stdin:
|
data = sys.stdin.read()
|
||||||
for c in line:
|
for i in range(0, len(data), 1):
|
||||||
num+=1
|
sys.stdout.write("0x%0.2X, " % ord(data[i:i+1]))
|
||||||
sys.stdout.write("0x%0.2X, " % ord(c))
|
|
||||||
if num%16 == 0:
|
if i%width == (width-1):
|
||||||
sys.stdout.write("\n")
|
sys.stdout.write("\n")
|
||||||
sys.stdout.write("0 };\n")
|
|
||||||
|
sys.stdout.write("0x00 };\n\n")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user