mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
Add retrieve_string(); use it in parse_androidmanifest
This commit is contained in:
parent
bc6e9cd4b4
commit
fa552b12cb
@ -861,6 +861,15 @@ def description_html(lines,linkres):
|
|||||||
ps.end()
|
ps.end()
|
||||||
return ps.text_html
|
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', '*string*.xml')):
|
||||||
|
for line in file(xmlfile):
|
||||||
|
matches = string_search(line)
|
||||||
|
if matches:
|
||||||
|
return matches.group(1)
|
||||||
|
return ''
|
||||||
|
|
||||||
# Retrieve the package name
|
# Retrieve the package name
|
||||||
def fetch_real_name(app_dir):
|
def fetch_real_name(app_dir):
|
||||||
@ -880,20 +889,7 @@ def fetch_real_name(app_dir):
|
|||||||
name = matches.group(1)
|
name = matches.group(1)
|
||||||
|
|
||||||
if name.startswith('@string/'):
|
if name.startswith('@string/'):
|
||||||
id = name[8:]
|
return retrieve_string(app_dir, name[8:])
|
||||||
name2 = None
|
|
||||||
string_search= re.compile(r'.*"'+id+'".*>([^<]+?)<.*').search
|
|
||||||
for xmlfile in glob.glob(os.path.join(
|
|
||||||
app_dir, 'res', 'values', '*string*.xml')):
|
|
||||||
for line in file(xmlfile):
|
|
||||||
if name2 is not None:
|
|
||||||
break
|
|
||||||
matches = string_search(line)
|
|
||||||
if matches:
|
|
||||||
name2 = matches.group(1)
|
|
||||||
if name2 is not None:
|
|
||||||
return name2
|
|
||||||
return ''
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return name
|
return name
|
||||||
@ -923,23 +919,8 @@ def parse_androidmanifest(app_dir):
|
|||||||
matches = vcsearch(line)
|
matches = vcsearch(line)
|
||||||
if matches:
|
if matches:
|
||||||
vercode = matches.group(1)
|
vercode = matches.group(1)
|
||||||
if version:
|
if version.startswith('@string/'):
|
||||||
return (version, vercode, package)
|
version = retrieve_string(app_dir, version[8:])
|
||||||
for xmlfile in glob.glob(os.path.join(
|
|
||||||
app_dir, 'res', 'values', 'strings*transl*.xml')):
|
|
||||||
for line in file(xmlfile):
|
|
||||||
if not version:
|
|
||||||
matches = vnsearch_xml(line)
|
|
||||||
if matches:
|
|
||||||
version = matches.group(2)
|
|
||||||
if not version:
|
|
||||||
for line in file(os.path.join(app_dir, 'res/values/strings.xml')):
|
|
||||||
if not version:
|
|
||||||
matches = vnsearch_xml(line)
|
|
||||||
if matches:
|
|
||||||
version = matches.group(2)
|
|
||||||
if not version:
|
|
||||||
version = "None"
|
|
||||||
return (version, vercode, package)
|
return (version, vercode, package)
|
||||||
|
|
||||||
class BuildException(Exception):
|
class BuildException(Exception):
|
||||||
|
Loading…
Reference in New Issue
Block a user