Commit b817c618 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

build: Update keysym generator to Python3

parent a00d4193
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org> # Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc. # Copyright (C) 2010-2011 Red Hat, Inc.
...@@ -23,7 +23,7 @@ import sys ...@@ -23,7 +23,7 @@ import sys
import re import re
if len(sys.argv) > 3: if len(sys.argv) > 3:
print >> sys.stderr, "Usage: %s TABLE-NAME [INPUT_FILE]" % sys.argv[0] print("Usage: %s TABLE-NAME [INPUT_FILE]" % sys.argv[0], file=sys.stderr)
sys.exit(-1) sys.exit(-1)
if len(sys.argv) < 3: if len(sys.argv) < 3:
...@@ -33,7 +33,6 @@ else: ...@@ -33,7 +33,6 @@ else:
table = dict() table = dict()
for line in in_stream: for line in in_stream:
line = line.decode('UTF-8')
match = re.match(r'\s*(0x[0-9A-F]+)\s+(\S*)\s+(\S*)', line, re.I) match = re.match(r'\s*(0x[0-9A-F]+)\s+(\S*)\s+(\S*)', line, re.I)
if match: if match:
table[int(match.group(1), 16)] = (match.group(2), match.group(3)) table[int(match.group(1), 16)] = (match.group(2), match.group(3))
...@@ -44,7 +43,7 @@ sys.stdout.write("static const EekKeysymEntry %s[] = {\n" % ...@@ -44,7 +43,7 @@ sys.stdout.write("static const EekKeysymEntry %s[] = {\n" %
for index, (keysym, (l, c)) in enumerate([(keysym, table[keysym]) for index, (keysym, (l, c)) in enumerate([(keysym, table[keysym])
for keysym in sorted(table.keys())]): for keysym in sorted(table.keys())]):
sys.stdout.write(" { 0x%X, %s, %s }" % sys.stdout.write(" { 0x%X, %s, %s }" %
(keysym, l.encode('UTF-8'), c.encode('UTF-8'))) (keysym, l, c))
if index < len(table) - 1: if index < len(table) - 1:
sys.stdout.write(",") sys.stdout.write(",")
sys.stdout.write("\n") sys.stdout.write("\n")
......
...@@ -14,7 +14,7 @@ marshalers = gnome.genmarshal( ...@@ -14,7 +14,7 @@ marshalers = gnome.genmarshal(
internal: true, internal: true,
) )
python = find_program('python2') python = find_program('python3')
gen_keysym_entries_special = generator( gen_keysym_entries_special = generator(
python, python,
......
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