mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
App names can contain \' too. Small optimisations.
This commit is contained in:
parent
9bb4ef0648
commit
c2168db3d5
@ -230,6 +230,13 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
|||||||
os.makedirs(icon_dir)
|
os.makedirs(icon_dir)
|
||||||
|
|
||||||
apks = []
|
apks = []
|
||||||
|
name_pat = re.compile(".*name='([a-zA-Z0-9._]*)'.*")
|
||||||
|
vercode_pat = re.compile(".*versionCode='([0-9]*)'.*")
|
||||||
|
vername_pat = re.compile(".*versionName='(.*)'[\n '].*")
|
||||||
|
label_pat = re.compile(".*label='(.*)'[\n '].*")
|
||||||
|
icon_pat = re.compile(".*icon='([^']*)'.*")
|
||||||
|
sdkversion_pat = re.compile(".*'([0-9]*)'.*")
|
||||||
|
string_pat = re.compile(".*'([^']*)'.*")
|
||||||
for apkfile in glob.glob(os.path.join(repodir, '*.apk')):
|
for apkfile in glob.glob(os.path.join(repodir, '*.apk')):
|
||||||
|
|
||||||
apkfilename = apkfile[len(repodir) + 1:]
|
apkfilename = apkfile[len(repodir) + 1:]
|
||||||
@ -265,32 +272,23 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for line in output.splitlines():
|
for line in output.splitlines():
|
||||||
if line.startswith("package:"):
|
if line.startswith("package:"):
|
||||||
pat = re.compile(".*name='([a-zA-Z0-9._]*)'.*")
|
thisinfo['id'] = re.match(name_pat, line).group(1)
|
||||||
thisinfo['id'] = re.match(pat, line).group(1)
|
thisinfo['versioncode'] = int(re.match(vercode_pat, line).group(1))
|
||||||
pat = re.compile(".*versionCode='([0-9]*)'.*")
|
thisinfo['version'] = re.match(vername_pat, line).group(1)
|
||||||
thisinfo['versioncode'] = int(re.match(pat, line).group(1))
|
elif line.startswith("application:"):
|
||||||
pat = re.compile(".*versionName='([^']*)'.*")
|
thisinfo['name'] = re.match(label_pat, line).group(1)
|
||||||
thisinfo['version'] = re.match(pat, line).group(1)
|
thisinfo['iconsrc'] = re.match(icon_pat, line).group(1)
|
||||||
if line.startswith("application:"):
|
elif line.startswith("sdkVersion:"):
|
||||||
pat = re.compile(".*label='([^']*)'.*")
|
thisinfo['sdkversion'] = re.match(sdkversion_pat, line).group(1)
|
||||||
thisinfo['name'] = re.match(pat, line).group(1)
|
elif line.startswith("native-code:"):
|
||||||
pat = re.compile(".*icon='([^']*)'.*")
|
thisinfo['nativecode'] = re.match(string_pat, line).group(1)
|
||||||
thisinfo['iconsrc'] = re.match(pat, line).group(1)
|
elif line.startswith("uses-permission:"):
|
||||||
if line.startswith("sdkVersion:"):
|
perm = re.match(string_pat, line).group(1)
|
||||||
pat = re.compile(".*'([0-9]*)'.*")
|
|
||||||
thisinfo['sdkversion'] = re.match(pat, line).group(1)
|
|
||||||
if line.startswith("native-code:"):
|
|
||||||
pat = re.compile(".*'([^']*)'.*")
|
|
||||||
thisinfo['nativecode'] = re.match(pat, line).group(1)
|
|
||||||
if line.startswith("uses-permission:"):
|
|
||||||
pat = re.compile(".*'([^']*)'.*")
|
|
||||||
perm = re.match(pat, line).group(1)
|
|
||||||
if perm.startswith("android.permission."):
|
if perm.startswith("android.permission."):
|
||||||
perm = perm[19:]
|
perm = perm[19:]
|
||||||
thisinfo['permissions'].append(perm)
|
thisinfo['permissions'].append(perm)
|
||||||
if line.startswith("uses-feature:"):
|
elif line.startswith("uses-feature:"):
|
||||||
pat = re.compile(".*'([^']*)'.*")
|
perm = re.match(string_pat, line).group(1)
|
||||||
perm = re.match(pat, line).group(1)
|
|
||||||
#Filter out this, it's only added with the latest SDK tools and
|
#Filter out this, it's only added with the latest SDK tools and
|
||||||
#causes problems for lots of apps.
|
#causes problems for lots of apps.
|
||||||
if (perm != "android.hardware.screen.portrait" and
|
if (perm != "android.hardware.screen.portrait" and
|
||||||
|
Loading…
Reference in New Issue
Block a user