Created
May 25, 2021 15:33
-
-
Save eighthave/8dd736b4f7f43d3db5a8255ace43f41b to your computer and use it in GitHub Desktop.
list all known Android NDK versions as seen by fdroid/android-sdk-transparency-log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, requests | |
NDK_VERSION_NUMBER_REGEX = re.compile(r'[1-9][0-9]*\.[0-9]+\.[0-9]{7}(?:-[a-z0-9]+)?') | |
NDK_VERSION_REGEX = re.compile(r"""ndkVersion\s*[= ]\s*['"]([1-9][0-9]*\.[0-9]+\.[0-9]{7}(?:-[a-z0-9]+)?)["']""") | |
r = requests.get('https://gitlab.com/fdroid/android-sdk-transparency-log/-/raw/master/checksums.json') | |
data = r.json() | |
for url, entries in data.items(): | |
for d in entries: | |
if url.startswith('https://dl.google.com/android/repository/android-ndk-'): | |
m = re.search(r'Pkg.Revision = .*', d.get('source.properties', '')) | |
if m: | |
ndk_version = m.group() | |
print(ndk_version, end='\t\t') | |
v = NDK_VERSION_NUMBER_REGEX.search(ndk_version).group() | |
print(v) | |
for build_gradle_snippet in ( | |
'ndkVersion "%s"' % v, | |
"ndkVersion '%s'" % v, | |
'ndkVersion="%s"' % v, | |
'android.ndkVersion "%s"' % v, | |
): | |
n = NDK_VERSION_REGEX.search(build_gradle_snippet) | |
if n: | |
assert(n.group(1) == v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment