Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ndk version check & download link #1271

Merged
merged 2 commits into from
May 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def _install_android_ndk(self):
return ndk_dir

import re
_version = re.search('(.+?)[a-z]', self.android_ndk_version).group(1)
_version = int(re.search(r'(\d+)', self.android_ndk_version).group(1))

self.buildozer.info('Android NDK is missing, downloading')
# Welcome to the NDK URL hell!
Expand All @@ -422,28 +422,23 @@ def _install_android_ndk(self):
# from 10e on the URLs can be looked up at
# https://developer.android.com/ndk/downloads/older_releases

is_darwin = platform == 'darwin'
is_linux = platform.startswith('linux')

if platform in ('win32', 'cygwin'):
# Checking of 32/64 bits at Windows from: http://stackoverflow.com/a/1405971/798575
import struct
archive = 'android-ndk-r{0}-windows-{1}.zip'
is_64 = (8 * struct.calcsize("P") == 64)

elif platform in ('darwin', ):
if _version >= '10e':
archive = 'android-ndk-r{0}-darwin-{1}.zip'
elif _version >= '10c':
archive = 'android-ndk-r{0}-darwin-{1}.bin'
else:
archive = 'android-ndk-r{0}-darwin-{1}.tar.bz2'
is_64 = (os.uname()[4] == 'x86_64')

elif platform.startswith('linux'):
if _version >= '10e':
archive = 'android-ndk-r{0}-linux-{1}.zip'
elif _version >= '10c':
archive = 'android-ndk-r{0}-linux-{1}.bin'
elif is_darwin or is_linux:
_platform = 'linux' if is_linux else 'darwin'
if self.android_ndk_version in ['10c', '10d', '10e']:
ext = 'bin'
elif _version <= 10:
ext = 'tar.bz2'
else:
archive = 'android-ndk-r{0}-linux-{1}.tar.bz2'
ext = 'zip'
archive = 'android-ndk-r{0}-' + _platform + '-{1}.' + ext
is_64 = (os.uname()[4] == 'x86_64')
else:
raise SystemError('Unsupported platform: {}'.format(platform))
Expand All @@ -453,7 +448,7 @@ def _install_android_ndk(self):
archive = archive.format(self.android_ndk_version, architecture)
unpacked = unpacked.format(self.android_ndk_version)

if _version >= '10e':
if _version >= 11:
url = 'https://dl.google.com/android/repository/'
else:
url = 'http://dl.google.com/android/ndk/'
Expand Down