fix broken NDK extraction routine to correctly name resulting dir

If there were other NDKs installed, this just tried to rename the first
installed NDK.  Now it tries to rename all NDKs that are not named after
the NDK version.

!926
!927
This commit is contained in:
Hans-Christoph Steiner 2021-06-01 13:43:23 +02:00
parent bf4feab877
commit d6c8ecc3bc
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA

View file

@ -4117,8 +4117,9 @@ def _install_ndk(ndk):
zipfp.extract(info.filename, path=ndk_base) zipfp.extract(info.filename, path=ndk_base)
os.chmod(os.path.join(ndk_base, info.filename), 0o644) # nosec bandit B103 os.chmod(os.path.join(ndk_base, info.filename), 0o644) # nosec bandit B103
os.remove(zipball) os.remove(zipball)
extracted = glob.glob(os.path.join(ndk_base, '*'))[0] for extracted in glob.glob(os.path.join(ndk_base, '*')):
version = get_ndk_version(extracted) version = get_ndk_version(extracted)
if os.path.basename(extracted) != version:
ndk_dir = os.path.join(ndk_base, version) ndk_dir = os.path.join(ndk_base, version)
os.rename(extracted, ndk_dir) os.rename(extracted, ndk_dir)
if 'ndk_paths' not in config: if 'ndk_paths' not in config: