Commit 86a6596c authored by Arfrever Frehtes Taifersar Arahesis's avatar Arfrever Frehtes Taifersar Arahesis Committed by Milan Crha
Browse files

Bug #705028 - gen-western-table.py is not compatible with python3

parent e9c30871
......@@ -18,30 +18,37 @@
import sys
if sys.version_info[0] >= 3:
stdin = sys.stdin.buffer
stdout = sys.stdout.buffer
else:
stdin = sys.stdin
stdout = sys.stdout
var = None
strings = []
def output():
print "static const gchar %s_table[] = {" % var
stdout.write(b"static const gchar " + var + b"_table[] = {\n")
for s in strings:
print " \"%s\\0\"" % s
print "};"
stdout.write(b" \"" + s + b"\\0\"\n")
stdout.write(b"};\n")
print "static const guint %s_index[] = {" % var
stdout.write(b"static const guint " + var + b"_index[] = {\n")
index = 0
for s in strings:
print " %d," % index
stdout.write(b" " + str(index).encode() + b",\n")
index += len(s) + 1
print "};\n"
stdout.write(b"};\n\n")
(S_VAR, S_STRING) = range(0, 2)
state = S_VAR
print "/* This file is generated by gen-western-table.py. DO NOT EDIT */"
stdout.write(b"/* This file is generated by gen-western-table.py. DO NOT EDIT */\n")
for l in sys.stdin.readlines():
for l in stdin.readlines():
l = l.strip()
if l == "":
if l == b"":
state = S_VAR
output()
var = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment