fix python2 assumption

Change-Id: I2113f64bac9f1e7421416266d20004b35ddbc54b
This commit is contained in:
Caolán McNamara
2017-07-21 15:31:24 +01:00
parent a1826132c0
commit 7a7cba91a6
2 changed files with 4 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
import binascii
import polib
@@ -14,13 +14,13 @@ if len(sys.argv) < 2:
uiline = False
subpath = sys.argv[1]
print >> sys.stderr, "interim-update-for-gettext: processing ", subpath
print("interim-update-for-gettext: processing " + subpath)
messages = None
npos = 0
for dirpath, dirname, filenames in walk(subpath):
for filename in filenames:
ipath = join(dirpath, filename)
print >> sys.stderr, "interim-update-for-gettext: merging ", ipath
print("interim-update-for-gettext: merging " + ipath)
po = polib.pofile(ipath)
if len(po) != 0:
samplefile = po[0].occurrences[0][0]

View File

@@ -867,7 +867,7 @@ class _BaseEntry(object):
wrapwidth)
ret.append('')
usedirect = True
if type(ret[0] != unicode):
if not PY3 and type(ret[0] != unicode):
try:
usedirect = False
ret = u('\n').join(x.decode('utf-8') for x in ret)