mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
common: fix str fetching from manifest xml
This commit is contained in:
parent
d39bf37ce8
commit
dd8ad7a4fd
1 changed files with 5 additions and 5 deletions
|
@ -952,7 +952,7 @@ def retrieve_string(app_dir, string, xmlfiles=None):
|
||||||
if element.text is None:
|
if element.text is None:
|
||||||
return ""
|
return ""
|
||||||
s = XMLElementTree.tostring(element, encoding='utf-8', method='text')
|
s = XMLElementTree.tostring(element, encoding='utf-8', method='text')
|
||||||
return s.strip()
|
return s.decode('utf-8').strip()
|
||||||
|
|
||||||
for path in xmlfiles:
|
for path in xmlfiles:
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
|
@ -1000,7 +1000,7 @@ def fetch_real_name(app_dir, flavours):
|
||||||
continue
|
continue
|
||||||
if "{http://schemas.android.com/apk/res/android}label" not in app.attrib:
|
if "{http://schemas.android.com/apk/res/android}label" not in app.attrib:
|
||||||
continue
|
continue
|
||||||
label = app.attrib["{http://schemas.android.com/apk/res/android}label"].encode('utf-8')
|
label = app.attrib["{http://schemas.android.com/apk/res/android}label"]
|
||||||
result = retrieve_string_singleline(app_dir, label)
|
result = retrieve_string_singleline(app_dir, label)
|
||||||
if result:
|
if result:
|
||||||
result = result.strip()
|
result = result.strip()
|
||||||
|
@ -1112,15 +1112,15 @@ def parse_androidmanifests(paths, app):
|
||||||
try:
|
try:
|
||||||
xml = parse_xml(path)
|
xml = parse_xml(path)
|
||||||
if "package" in xml.attrib:
|
if "package" in xml.attrib:
|
||||||
s = xml.attrib["package"].encode('utf-8')
|
s = xml.attrib["package"]
|
||||||
if app_matches_packagename(app, s):
|
if app_matches_packagename(app, s):
|
||||||
package = s
|
package = s
|
||||||
if "{http://schemas.android.com/apk/res/android}versionName" in xml.attrib:
|
if "{http://schemas.android.com/apk/res/android}versionName" in xml.attrib:
|
||||||
version = xml.attrib["{http://schemas.android.com/apk/res/android}versionName"].encode('utf-8')
|
version = xml.attrib["{http://schemas.android.com/apk/res/android}versionName"]
|
||||||
base_dir = os.path.dirname(path)
|
base_dir = os.path.dirname(path)
|
||||||
version = retrieve_string_singleline(base_dir, version)
|
version = retrieve_string_singleline(base_dir, version)
|
||||||
if "{http://schemas.android.com/apk/res/android}versionCode" in xml.attrib:
|
if "{http://schemas.android.com/apk/res/android}versionCode" in xml.attrib:
|
||||||
a = xml.attrib["{http://schemas.android.com/apk/res/android}versionCode"].encode('utf-8')
|
a = xml.attrib["{http://schemas.android.com/apk/res/android}versionCode"]
|
||||||
if string_is_integer(a):
|
if string_is_integer(a):
|
||||||
vercode = a
|
vercode = a
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue