Kaydet (Commit) 7a7cba91 authored tarafından Caolán McNamara's avatar Caolán McNamara

fix python2 assumption

Change-Id: I2113f64bac9f1e7421416266d20004b35ddbc54b
üst a1826132
#!/usr/bin/python #!/usr/bin/env python3
import binascii import binascii
import polib import polib
...@@ -14,13 +14,13 @@ if len(sys.argv) < 2: ...@@ -14,13 +14,13 @@ if len(sys.argv) < 2:
uiline = False uiline = False
subpath = sys.argv[1] subpath = sys.argv[1]
print >> sys.stderr, "interim-update-for-gettext: processing ", subpath print("interim-update-for-gettext: processing " + subpath)
messages = None messages = None
npos = 0 npos = 0
for dirpath, dirname, filenames in walk(subpath): for dirpath, dirname, filenames in walk(subpath):
for filename in filenames: for filename in filenames:
ipath = join(dirpath, filename) ipath = join(dirpath, filename)
print >> sys.stderr, "interim-update-for-gettext: merging ", ipath print("interim-update-for-gettext: merging " + ipath)
po = polib.pofile(ipath) po = polib.pofile(ipath)
if len(po) != 0: if len(po) != 0:
samplefile = po[0].occurrences[0][0] samplefile = po[0].occurrences[0][0]
......
...@@ -867,7 +867,7 @@ class _BaseEntry(object): ...@@ -867,7 +867,7 @@ class _BaseEntry(object):
wrapwidth) wrapwidth)
ret.append('') ret.append('')
usedirect = True usedirect = True
if type(ret[0] != unicode): if not PY3 and type(ret[0] != unicode):
try: try:
usedirect = False usedirect = False
ret = u('\n').join(x.decode('utf-8') for x in ret) ret = u('\n').join(x.decode('utf-8') for x in ret)
......
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