From 1cf40636d393e10ef7a70f54b8ba02ce791ea1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 7 Jan 2014 10:04:11 +0100 Subject: [PATCH] Improve checkupdates regex, support quotes better for build.gradle --- fdroidserver/checkupdates.py | 6 +++++- fdroidserver/common.py | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index eff43ff4..d7c89eec 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -197,7 +197,11 @@ def check_repomanifest(app, branch=None): if not vercode: return (None,"Couldn't find latest version code") - return (version, str(int(vercode))) + vercode = str(int(vercode)) + + print "Manifest exists. Found version %s (%s)" % (version, vercode) + + return (version, vercode) except BuildException as be: msg = "Could not scan app %s due to BuildException: %s" % (app['id'], be) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index f648ef7d..6b82a701 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -683,9 +683,9 @@ def parse_androidmanifests(paths): vnsearch = re.compile(r'.*android:versionName="([^"]+?)".*').search psearch = re.compile(r'.*package="([^"]+)".*').search - vcsearch_g = re.compile(r'.*versionCode[ =]*([0-9]+?)[^\d].*').search - vnsearch_g = re.compile(r'.*versionName[ =]*"([^"]+?)".*').search - psearch_g = re.compile(r'.*packageName[ =]*"([^"]+)".*').search + vcsearch_g = re.compile(r'.*versionCode[ ]*=[ ]*["\']*([0-9]+?)[^\d].*').search + vnsearch_g = re.compile(r'.*versionName[ ]*=[ ]*(["\'])((?:(?=(\\?))\3.)*?)\1.*').search + psearch_g = re.compile(r'.*packageName[ ]*=[ ]*["\']([^"]+)["\'].*').search max_version = None max_vercode = None @@ -713,7 +713,7 @@ def parse_androidmanifests(paths): else: matches = vnsearch(line) if matches: - version = matches.group(1) + version = matches.group(2 if gradle else 1) if not vercode: if gradle: matches = vcsearch_g(line)