Skip to content

Commit

Permalink
fix ndk version check & download link
Browse files Browse the repository at this point in the history
  • Loading branch information
obfusk authored Jan 1, 2021
1 parent eecb248 commit 2e54174
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ def _install_android_ndk(self):
self.buildozer.info('Android NDK found at {0}'.format(ndk_dir))
return ndk_dir

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

self.buildozer.info('Android NDK is missing, downloading')
# Welcome to the NDK URL hell!
# a list of all NDK URLs up to level 14 can be found here:
Expand All @@ -422,28 +419,25 @@ 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 in ('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:
import re
_version = int(re.search('(\d+)', self.android_ndk_version).group(1))
_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 Down

0 comments on commit 2e54174

Please sign in to comment.