mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 23:12:46 +03:00
build: reuse common methods for getting metadata from APKs
This splits out the code that gets the list of native ABIs supported, then uses the standard methods for the rest.
This commit is contained in:
parent
487c4d02f3
commit
807bf3d26b
4 changed files with 109 additions and 79 deletions
|
@ -2128,6 +2128,19 @@ def get_apk_id_aapt(apkfile):
|
|||
.format(apkfilename=apkfile))
|
||||
|
||||
|
||||
def get_native_code(apkfile):
|
||||
"""aapt checks if there are architecture folders under the lib/ folder
|
||||
so we are simulating the same behaviour"""
|
||||
arch_re = re.compile("^lib/(.*)/.*$")
|
||||
archset = set()
|
||||
with ZipFile(apkfile) as apk:
|
||||
for filename in apk.namelist():
|
||||
m = arch_re.match(filename)
|
||||
if m:
|
||||
archset.add(m.group(1))
|
||||
return sorted(list(archset))
|
||||
|
||||
|
||||
def get_minSdkVersion_aapt(apkfile):
|
||||
"""Extract the minimum supported Android SDK from an APK using aapt
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue