diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index ee80bca6..d030f4a6 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -304,15 +304,18 @@ def main(): vcs = common.getvcs(app["Repo Type"], app["Repo"], app_dir, sdk_path) vcs.gotorevision(None) + flavour = None if len(app['builds']) > 0: if 'subdir' in app['builds'][-1]: app_dir = os.path.join(app_dir, app['builds'][-1]['subdir']) + if 'gradle' in app['builds'][-1]: + flavour = app['builds'][-1]['gradle'] + + new_name = common.fetch_real_name(app_dir, flavour) + if new_name != app['Auto Name']: + app['Auto Name'] = new_name + writeit = True - #new_name = common.fetch_real_name(app_dir) - #if new_name != app['Auto Name']: - #app['Auto Name'] = new_name - #if not writeit: - #writeit = True except Exception: msg = "Auto Name failed for %s due to exception: %s" % (app['id'], traceback.format_exc()) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 6664ce69..4a188c08 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -862,21 +862,19 @@ def description_html(lines,linkres): ps.end() return ps.text_html -def retrieve_string(app_dir, string_id): - string_search = re.compile(r'.*"'+string_id+'".*>([^<]+?)<.*').search - for xmlfile in glob.glob(os.path.join( - app_dir, 'res', 'values', '*.xml')): +def retrieve_string(xml_dir, string): + print 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: - s = matches.group(1) - if s.startswith('@string/'): - return retrieve_string(app_dir, s[8:]); - return s.replace("\\'","'") + return retrieve_string(xml_dir, matches.group(1)) return '' -# Return list of existing AM.xml files that will be used to find the highest -# vercode +# Return list of existing files that will be used to find the highest vercode def manifest_paths(app_dir, flavour): possible_manifests = [ os.path.join(app_dir, 'AndroidManifest.xml'), @@ -886,30 +884,30 @@ def manifest_paths(app_dir, flavour): if flavour is not None: possible_manifests.append( os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml')) - + return [path for path in possible_manifests if os.path.isfile(path)] - # Retrieve the package name -def fetch_real_name(app_dir): +def fetch_real_name(app_dir, flavour): app_search = re.compile(r'.*