chiark / gitweb /
Only match label of the first application element
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 14 Jun 2013 08:06:22 +0000 (10:06 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 14 Jun 2013 08:06:22 +0000 (10:06 +0200)
fdroidserver/common.py

index c14e766adb36139d3b7808ed720ee337c693823e..35d2551f8fd54d9da39e4f3c09e62811a4dd132c 100644 (file)
@@ -864,14 +864,20 @@ def description_html(lines,linkres):
 
 # Retrieve the package name
 def fetch_real_name(app_dir):
+    app_search = re.compile(r'.*<application.*').search
     name_search = re.compile(r'.*android:label="([^"]+)".*').search
+    app_found = False
     name = None
     for line in file(os.path.join(app_dir, 'AndroidManifest.xml')):
-        if name is not None:
-            break
-        matches = name_search(line)
-        if matches:
-            name = matches.group(1)
+        if not app_found:
+            if app_search(line):
+                app_found = True
+        else:
+            if name is not None:
+                break
+            matches = name_search(line)
+            if matches:
+                name = matches.group(1)
 
     if name.startswith('@string/'):
         id = name[8:]