diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@GMail.Com> | 2014-02-25 16:04:47 +0100 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-02-25 16:04:47 +0100 |
commit | 86a6596c05187022a9fd95a66cc43bbd7481cce3 (patch) | |
tree | c8ec54bdb08d64fe602661e7ea32c470a1590a6e | |
parent | e9c30871f7ef2c6040980dbd59ccf32d069253bd (diff) | |
download | evolution-data-server-86a6596c05187022a9fd95a66cc43bbd7481cce3.tar.gz |
Bug #705028 - gen-western-table.py is not compatible with python3
-rwxr-xr-x | addressbook/libebook-contacts/gen-western-table.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/addressbook/libebook-contacts/gen-western-table.py b/addressbook/libebook-contacts/gen-western-table.py index cdd2514d4..3456fd814 100755 --- a/addressbook/libebook-contacts/gen-western-table.py +++ b/addressbook/libebook-contacts/gen-western-table.py @@ -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 |