diff --git a/buildozer/__init__.py b/buildozer/__init__.py index cda948d..f83d317 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -206,7 +206,7 @@ class Buildozer(object): color = COLOR_SEQ(LOG_LEVELS_C[level]) print(''.join((RESET_SEQ, color, '# ', msg, RESET_SEQ))) else: - print(LOG_LEVELS_T[level], msg) + print('{} {}'.format(LOG_LEVELS_T[level], msg)) def debug(self, msg): self.log(2, msg) diff --git a/buildozer/jsonstore.py b/buildozer/jsonstore.py index 03f60d7..a70d5c4 100644 --- a/buildozer/jsonstore.py +++ b/buildozer/jsonstore.py @@ -6,9 +6,11 @@ This is currently needed to correctly support db between Python 2 and 3. __all__ = ["JsonStore"] import io -from json import load, dump +import sys +from json import load, dump, dumps from os.path import exists +IS_PY3 = sys.version_info[0] >= 3 class JsonStore(object): @@ -44,6 +46,11 @@ class JsonStore(object): return self.data.keys() def sync(self): - with io.open(self.filename, 'w', encoding='utf-8') as fd: - dump(self.data, fd) + # http://stackoverflow.com/questions/12309269/write-json-data-to-file-in-python/14870531#14870531 + if IS_PY3: + with open(self.filename, 'w') as fd: + dump(self.data, fd, ensure_ascii=False) + else: + with io.open(self.filename, 'w', encoding='utf-8') as fd: + fd.write(unicode(dumps(self.data, ensure_ascii=False))) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index d6d4d5a..00d5dd1 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -616,9 +616,9 @@ class TargetAndroid(Target): # recreate the project.properties with io.open(project_fn, 'w', encoding='utf-8') as fd: for line in content: - fd.write(line) + fd.write(line.decode('utf-8')) for index, ref in enumerate(references): - fd.write('android.library.reference.{}={}\n'.format( + fd.write(u'android.library.reference.{}={}\n'.format( index + 1, ref)) self.buildozer.debug('project.properties updated')