Only match label of the first application element

This commit is contained in:
Daniel Martí 2013-06-14 10:06:22 +02:00
parent 3f7b6b8734
commit d1ef217895

View file

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