some python 3 compatibility

This commit is contained in:
pohmelie 2015-04-06 16:41:39 +03:00
parent 6f842d01ce
commit c4c74050bf

View file

@ -23,6 +23,7 @@ import io
from pipes import quote from pipes import quote
from sys import platform, executable from sys import platform, executable
from buildozer import BuildozerException from buildozer import BuildozerException
from buildozer import IS_PY3
from buildozer.target import Target from buildozer.target import Target
from os import environ from os import environ
from os.path import exists, join, realpath, expanduser, basename, relpath from os.path import exists, join, realpath, expanduser, basename, relpath
@ -699,6 +700,9 @@ class TargetAndroid(Target):
# recreate the project.properties # recreate the project.properties
with io.open(project_fn, 'w', encoding='utf-8') as fd: with io.open(project_fn, 'w', encoding='utf-8') as fd:
for line in content: for line in content:
if IS_PY3:
fd.write(line)
else:
fd.write(line.decode('utf-8')) fd.write(line.decode('utf-8'))
for index, ref in enumerate(references): for index, ref in enumerate(references):
fd.write(u'android.library.reference.{}={}\n'.format( fd.write(u'android.library.reference.{}={}\n'.format(