From 81b1a498dd4b124db1dc2bdddd0967549e650b93 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 6 Feb 2017 02:29:12 +0000 Subject: [PATCH] android: fix ndk download link, and use unzip from system directly (zipfile from python have issue with permission, it doesn't give executable bit to executable.) --- .gitignore | 2 ++ buildozer/__init__.py | 5 +---- buildozer/targets/android.py | 14 +++++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 2d40d28..3a75d55 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ pip-log.txt #Mr Developer .mr.developer.cfg MANIFEST + +release\.log\.utf-8\.tmp diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 1341225..d87a3df 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -627,10 +627,7 @@ class Buildozer(object): return if archive.endswith('.zip'): - archive = join(cwd, archive) - zf = zipfile.ZipFile(archive) - zf.extractall(path=cwd) - zf.close() + self.cmd('unzip {}'.format(join(cwd, archive)), cwd=cwd) return raise Exception('Unhandled extraction for type {0}'.format(archive)) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 46f3e80..1b0ab02 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -292,7 +292,7 @@ class TargetAndroid(Target): elif platform.startswith('linux'): if int(_version) > 9: # if greater than 9, take it as .bin file - archive = 'android-ndk-r{0}-linux-{1}.bin' + archive = 'android-ndk-r{0}-linux-{1}.zip' else: archive = 'android-ndk-r{0}-linux-{1}.tar.bz2' is_64 = (os.uname()[4] == 'x86_64') @@ -303,7 +303,7 @@ class TargetAndroid(Target): unpacked = 'android-ndk-r{0}' archive = archive.format(self.android_ndk_version, architecture) unpacked = unpacked.format(self.android_ndk_version) - url = 'http://dl.google.com/android/ndk/' + url = 'http://dl.google.com/android/repository/' self.buildozer.download(url, archive, cwd=self.buildozer.global_platform_dir) @@ -755,6 +755,14 @@ class TargetAndroid(Target): self.execute_build_package(build_cmd) + try: + self.buildozer.hook("android_pre_build_apk") + self.execute_build_package(build_cmd) + self.buildozer.hook("android_post_build_apk") + except: + # maybe the hook fail because the apk is not + pass + # XXX found how the apk name is really built from the title bl = u'\'" ,' apptitle = config.get('app', 'title') @@ -814,7 +822,7 @@ class TargetAndroid(Target): with io.open(project_fn, 'w', encoding='utf-8') as fd: fd.writelines(content) for index, ref in enumerate(references): - fd.write(u'\nandroid.library.reference.{}={}'.format(index + 1, + fd.write(u'android.library.reference.{}={}\n'.format(index + 1, ref)) self.buildozer.debug('project.properties updated')