chiark / gitweb /
Don't use an autoname if it's not found
authorCiaran Gultnieks <ciaran@ciarang.com>
Sun, 16 Mar 2014 22:12:37 +0000 (22:12 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Sun, 16 Mar 2014 22:12:37 +0000 (22:12 +0000)
fdroidserver/checkupdates.py
fdroidserver/common.py

index b56aa2013088f5d0b8345a94105b70442bafaa24..4609374dbab9c3d857c0ee9189ecc051f96e61bf 100644 (file)
@@ -416,11 +416,14 @@ def main():
                 logging.debug("...fetch auto name from " + app_dir +
                         ((" (flavour:" + flavour) if flavour else ""))
                 new_name = common.fetch_real_name(app_dir, flavour)
-                logging.debug("...got autoname '" + new_name + "'")
-                if new_name != app['Auto Name']:
-                    app['Auto Name'] = new_name
-                    if not commitmsg:
-                        commitmsg = "Set autoname of {0}".format(common.getappname(app))
+                if new_name:
+                    logging.debug("...got autoname '" + new_name + "'")
+                    if new_name != app['Auto Name']:
+                        app['Auto Name'] = new_name
+                        if not commitmsg:
+                            commitmsg = "Set autoname of {0}".format(common.getappname(app))
+                else:
+                    logging.debug("...couldn't get autoname")
 
                 if app['Current Version'].startswith('@string/'):
                     cv = common.version_name(app['Current Version'], app_dir, flavour)
index 388e3970b9212e08df1e9fee249fab31e2d01981..98d2752fa311d50a1346f8b1f5381349ad003031 100644 (file)
@@ -611,6 +611,7 @@ def retrieve_string(app_dir, string, xmlfiles=None):
                 matches = string_search(line)
                 if matches:
                     return retrieve_string(app_dir, matches.group(1), xmlfiles)
+        return None
 
     return string.replace("\\'","'")
 
@@ -627,7 +628,7 @@ def manifest_paths(app_dir, flavour):
 
     return [path for path in possible_manifests if os.path.isfile(path)]
 
-# Retrieve the package name
+# Retrieve the package name. Returns the name, or None if not found.
 def fetch_real_name(app_dir, flavour):
     app_search = re.compile(r'.*<application.*').search
     name_search = re.compile(r'.*android:label="([^"]+)".*').search
@@ -646,7 +647,7 @@ def fetch_real_name(app_dir, flavour):
                     stringname = matches.group(1)
                     logging.debug("fetch_real_name: using string " + stringname)
                     return retrieve_string(app_dir, stringname).strip()
-    return ''
+    return None
 
 # Retrieve the version name
 def version_name(original, app_dir, flavour):