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.)

This commit is contained in:
Mathieu Virbel 2017-02-06 02:29:12 +00:00
parent 3e931fc706
commit 81b1a498dd
3 changed files with 14 additions and 7 deletions

2
.gitignore vendored
View file

@ -29,3 +29,5 @@ pip-log.txt
#Mr Developer #Mr Developer
.mr.developer.cfg .mr.developer.cfg
MANIFEST MANIFEST
release\.log\.utf-8\.tmp

View file

@ -627,10 +627,7 @@ class Buildozer(object):
return return
if archive.endswith('.zip'): if archive.endswith('.zip'):
archive = join(cwd, archive) self.cmd('unzip {}'.format(join(cwd, archive)), cwd=cwd)
zf = zipfile.ZipFile(archive)
zf.extractall(path=cwd)
zf.close()
return return
raise Exception('Unhandled extraction for type {0}'.format(archive)) raise Exception('Unhandled extraction for type {0}'.format(archive))

View file

@ -292,7 +292,7 @@ class TargetAndroid(Target):
elif platform.startswith('linux'): elif platform.startswith('linux'):
if int(_version) > 9: # if greater than 9, take it as .bin file 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: else:
archive = 'android-ndk-r{0}-linux-{1}.tar.bz2' archive = 'android-ndk-r{0}-linux-{1}.tar.bz2'
is_64 = (os.uname()[4] == 'x86_64') is_64 = (os.uname()[4] == 'x86_64')
@ -303,7 +303,7 @@ class TargetAndroid(Target):
unpacked = 'android-ndk-r{0}' unpacked = 'android-ndk-r{0}'
archive = archive.format(self.android_ndk_version, architecture) archive = archive.format(self.android_ndk_version, architecture)
unpacked = unpacked.format(self.android_ndk_version) 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, self.buildozer.download(url,
archive, archive,
cwd=self.buildozer.global_platform_dir) cwd=self.buildozer.global_platform_dir)
@ -755,6 +755,14 @@ class TargetAndroid(Target):
self.execute_build_package(build_cmd) 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 # XXX found how the apk name is really built from the title
bl = u'\'" ,' bl = u'\'" ,'
apptitle = config.get('app', 'title') apptitle = config.get('app', 'title')
@ -814,7 +822,7 @@ class TargetAndroid(Target):
with io.open(project_fn, 'w', encoding='utf-8') as fd: with io.open(project_fn, 'w', encoding='utf-8') as fd:
fd.writelines(content) fd.writelines(content)
for index, ref in enumerate(references): 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)) ref))
self.buildozer.debug('project.properties updated') self.buildozer.debug('project.properties updated')