From bf61dcf708f03521bf03d184214fa7ea418ceca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 2 Dec 2013 15:09:59 +0100 Subject: [PATCH] Support application names in the form of '&app_name;' --- fdroidserver/common.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index d588e1f3..b6c7b9c1 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -459,15 +459,22 @@ class vcs_bzr(vcs): p.communicate()[0].splitlines()] def retrieve_string(xml_dir, string): - if not string.startswith('@string/'): - return string.replace("\\'","'") - string_search = re.compile(r'.*"'+string[8:]+'".*>([^<]+?)<.*').search - for xmlfile in glob.glob(os.path.join(xml_dir, '*.xml')): - for line in file(xmlfile): - matches = string_search(line) - if matches: - return retrieve_string(xml_dir, matches.group(1)) - return '' + if string.startswith('@string/'): + string_search = re.compile(r'.*"'+string[8:]+'".*>([^<]+?)<.*').search + for xmlfile in glob.glob(os.path.join(xml_dir, '*.xml')): + for line in file(xmlfile): + matches = string_search(line) + if matches: + return retrieve_string(xml_dir, matches.group(1)) + elif string.startswith('&') and string.endswith(';'): + string_search = re.compile(r'.*').search + for xmlfile in glob.glob(os.path.join(xml_dir, '*.xml')): + for line in file(xmlfile): + matches = string_search(line) + if matches: + return retrieve_string(xml_dir, matches.group(1)) + + return string.replace("\\'","'") # Return list of existing files that will be used to find the highest vercode def manifest_paths(app_dir, flavour):