From 51d961630b80ac46c4502b65f082dce7b1361623 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 6 Dec 2018 13:42:45 +0100 Subject: [PATCH] fix aapt scraping of with maxSdkVersion 3e0d1beb090fc3a05dc77ce65f6e5d295d7e93ef changed this logic a bit, and it wasn't quite right. Then changing the SDK Versions to integers everywhere seemed to bring this out more. --- fdroidserver/update.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 5b33d805..97a69b89 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -60,7 +60,7 @@ APK_VERCODE_PAT = re.compile(".*versionCode='([0-9]*)'.*") APK_VERNAME_PAT = re.compile(".*versionName='([^']*)'.*") APK_LABEL_ICON_PAT = re.compile(r".*\s+label='(.*)'\s+icon='(.*?)'") APK_SDK_VERSION_PAT = re.compile(".*'([0-9]*)'.*") -APK_PERMISSION_PAT = re.compile(r".*(name='(.*)')(.*maxSdkVersion='(.*)')?.*") +APK_PERMISSION_PAT = re.compile(r".*name='([^']*)'(?:.*maxSdkVersion='([^']*)')?.*") APK_FEATURE_PAT = re.compile(".*name='([^']*)'.*") screen_densities = ['65534', '640', '480', '320', '240', '160', '120'] @@ -1176,23 +1176,18 @@ def scan_apk_aapt(apk, apkfile): apk['nativecode'].append(arch[1:-1]) elif line.startswith('uses-permission:'): perm_match = re.match(APK_PERMISSION_PAT, line).groups() - if perm_match[2]: - perm_match[2] = int(perm_match[2]) # maxSdkVersion is an int permission = UsesPermission( - perm_match[1], # name - perm_match[2], # maxSdkVersion + perm_match[0], # name + None if perm_match[1] is None else int(perm_match[1]), # maxSdkVersion ) - apk['uses-permission'].append(permission) + elif line.startswith('uses-permission-sdk-23:'): perm_match = re.match(APK_PERMISSION_PAT, line).groups() - if perm_match[2]: - perm_match[2] = int(perm_match[2]) # maxSdkVersion is an int permission_sdk_23 = UsesPermissionSdk23( - perm_match[1], # name - perm_match[2], # maxSdkVersion + perm_match[0], # name + None if perm_match[1] is None else int(perm_match[1]), # maxSdkVersion ) - apk['uses-permission-sdk-23'].append(permission_sdk_23) elif line.startswith('uses-feature:'):