Merge comparisons with 'in'
This commit is contained in:
parent
f4739ef3c0
commit
cf0100cf11
|
@ -191,7 +191,7 @@ def check_tags(app, pattern):
|
||||||
root_dir = build_dir / subdir
|
root_dir = build_dir / subdir
|
||||||
paths = common.manifest_paths(root_dir, last_build.gradle)
|
paths = common.manifest_paths(root_dir, last_build.gradle)
|
||||||
version, vercode, _package = common.parse_androidmanifests(paths, app)
|
version, vercode, _package = common.parse_androidmanifests(paths, app)
|
||||||
if version == 'Unknown' or version == 'Ignore':
|
if version in ('Unknown', 'Ignore'):
|
||||||
version = tag
|
version = tag
|
||||||
if vercode:
|
if vercode:
|
||||||
logging.debug("Manifest exists in subdir '{0}'. Found version {1} ({2})"
|
logging.debug("Manifest exists in subdir '{0}'. Found version {1} ({2})"
|
||||||
|
|
|
@ -2616,7 +2616,7 @@ def get_apk_id_androguard(apkfile):
|
||||||
|
|
||||||
if axml.getName() == 'manifest':
|
if axml.getName() == 'manifest':
|
||||||
break
|
break
|
||||||
elif _type == END_TAG or _type == TEXT or _type == END_DOCUMENT:
|
elif _type in (END_TAG, TEXT, END_DOCUMENT):
|
||||||
raise RuntimeError('{path}: <manifest> must be the first element in AndroidManifest.xml'
|
raise RuntimeError('{path}: <manifest> must be the first element in AndroidManifest.xml'
|
||||||
.format(path=apkfile))
|
.format(path=apkfile))
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ def get_app_from_url(url):
|
||||||
app.RepoType = 'git'
|
app.RepoType = 'git'
|
||||||
app.SourceCode = url
|
app.SourceCode = url
|
||||||
app.IssueTracker = url + '/issues'
|
app.IssueTracker = url + '/issues'
|
||||||
elif parsed.netloc == 'gitlab.com' or parsed.netloc == 'framagit.org':
|
elif parsed.netloc in ('gitlab.com', 'framagit.org'):
|
||||||
# git can be fussy with gitlab URLs unless they end in .git
|
# git can be fussy with gitlab URLs unless they end in .git
|
||||||
if url.endswith('.git'):
|
if url.endswith('.git'):
|
||||||
url = url[:-4]
|
url = url[:-4]
|
||||||
|
|
|
@ -98,7 +98,7 @@ def main():
|
||||||
# exist, prompt the user using platform-specific default
|
# exist, prompt the user using platform-specific default
|
||||||
# and if the user leaves it blank, ignore and move on.
|
# and if the user leaves it blank, ignore and move on.
|
||||||
default_sdk_path = ''
|
default_sdk_path = ''
|
||||||
if sys.platform == 'win32' or sys.platform == 'cygwin':
|
if sys.platform in ('win32', 'cygwin'):
|
||||||
p = os.path.join(
|
p = os.path.join(
|
||||||
os.getenv('USERPROFILE'), 'AppData', 'Local', 'Android', 'android-sdk'
|
os.getenv('USERPROFILE'), 'AppData', 'Local', 'Android', 'android-sdk'
|
||||||
)
|
)
|
||||||
|
|
|
@ -108,7 +108,7 @@ def px_to_dpi(px):
|
||||||
|
|
||||||
|
|
||||||
def get_icon_dir(repodir, density):
|
def get_icon_dir(repodir, density):
|
||||||
if density == '0' or density == '65534':
|
if density in ('0', '65534'):
|
||||||
return os.path.join(repodir, "icons")
|
return os.path.join(repodir, "icons")
|
||||||
else:
|
else:
|
||||||
return os.path.join(repodir, "icons-%s" % density)
|
return os.path.join(repodir, "icons-%s" % density)
|
||||||
|
@ -647,7 +647,7 @@ def _strip_and_copy_image(in_file, outpath):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(_("Failed copying {path}: {error}".format(path=in_file, error=e)))
|
logging.error(_("Failed copying {path}: {error}".format(path=in_file, error=e)))
|
||||||
return
|
return
|
||||||
elif extension == 'jpg' or extension == 'jpeg':
|
elif extension in ('jpg', 'jpeg'):
|
||||||
try:
|
try:
|
||||||
with open(in_file, 'rb') as fp:
|
with open(in_file, 'rb') as fp:
|
||||||
in_image = Image.open(fp)
|
in_image = Image.open(fp)
|
||||||
|
@ -866,16 +866,16 @@ def copy_triple_t_store_metadata(apps):
|
||||||
locale = segments[-2]
|
locale = segments[-2]
|
||||||
|
|
||||||
for f in files:
|
for f in files:
|
||||||
if f == 'fulldescription' or f == 'full-description.txt':
|
if f in ('fulldescription', 'full-description.txt'):
|
||||||
_set_localized_text_entry(app, locale, 'description',
|
_set_localized_text_entry(app, locale, 'description',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
elif f == 'shortdescription' or f == 'short-description.txt':
|
elif f in ('shortdescription', 'short-description.txt'):
|
||||||
_set_localized_text_entry(app, locale, 'summary',
|
_set_localized_text_entry(app, locale, 'summary',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
elif f == 'title' or f == 'title.txt':
|
elif f in ('title', 'title.txt'):
|
||||||
_set_localized_text_entry(app, locale, 'name',
|
_set_localized_text_entry(app, locale, 'name',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
elif f == 'video' or f == 'video-url.txt':
|
elif f in ('video', 'video-url.txt'):
|
||||||
_set_localized_text_entry(app, locale, 'video',
|
_set_localized_text_entry(app, locale, 'video',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
elif f == 'whatsnew':
|
elif f == 'whatsnew':
|
||||||
|
@ -884,11 +884,11 @@ def copy_triple_t_store_metadata(apps):
|
||||||
elif f == 'default.txt' and segments[-2] == 'release-notes':
|
elif f == 'default.txt' and segments[-2] == 'release-notes':
|
||||||
_set_localized_text_entry(app, locale, 'whatsNew',
|
_set_localized_text_entry(app, locale, 'whatsNew',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
elif f == 'contactEmail' or f == 'contact-email.txt':
|
elif f in ('contactEmail', 'contact-email.txt'):
|
||||||
_set_author_entry(app, 'authorEmail', os.path.join(root, f))
|
_set_author_entry(app, 'authorEmail', os.path.join(root, f))
|
||||||
elif f == 'contactPhone' or f == 'contact-phone.txt':
|
elif f in ('contactPhone', 'contact-phone.txt'):
|
||||||
_set_author_entry(app, 'authorPhone', os.path.join(root, f))
|
_set_author_entry(app, 'authorPhone', os.path.join(root, f))
|
||||||
elif f == 'contactWebsite' or f == 'contact-website.txt':
|
elif f in ('contactWebsite', 'contact-website.txt'):
|
||||||
_set_author_entry(app, 'authorWebSite', os.path.join(root, f))
|
_set_author_entry(app, 'authorWebSite', os.path.join(root, f))
|
||||||
else:
|
else:
|
||||||
base, extension = common.get_extension(f)
|
base, extension = common.get_extension(f)
|
||||||
|
@ -1113,7 +1113,7 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
|
||||||
repodir = repodir.encode()
|
repodir = repodir.encode()
|
||||||
for name in os.listdir(repodir):
|
for name in os.listdir(repodir):
|
||||||
file_extension = common.get_file_extension(name)
|
file_extension = common.get_file_extension(name)
|
||||||
if file_extension == 'apk' or file_extension == 'obb':
|
if file_extension in ('apk', 'obb'):
|
||||||
continue
|
continue
|
||||||
filename = os.path.join(repodir, name)
|
filename = os.path.join(repodir, name)
|
||||||
name_utf8 = name.decode()
|
name_utf8 = name.decode()
|
||||||
|
@ -1405,8 +1405,10 @@ def scan_apk_androguard(apk, apkfile):
|
||||||
if key not in item.attrib:
|
if key not in item.attrib:
|
||||||
continue
|
continue
|
||||||
feature = str(item.attrib[key])
|
feature = str(item.attrib[key])
|
||||||
if feature != "android.hardware.screen.portrait" \
|
if feature not in (
|
||||||
and feature != "android.hardware.screen.landscape":
|
'android.hardware.screen.portrait',
|
||||||
|
'android.hardware.screen.landscape',
|
||||||
|
):
|
||||||
if feature.startswith("android.feature."):
|
if feature.startswith("android.feature."):
|
||||||
feature = feature[16:]
|
feature = feature[16:]
|
||||||
required = item.attrib.get(xmlns + 'required')
|
required = item.attrib.get(xmlns + 'required')
|
||||||
|
|
|
@ -616,7 +616,7 @@ if __name__ == '__main__':
|
||||||
virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8')
|
virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8')
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
virt = 'none'
|
virt = 'none'
|
||||||
if virt == 'qemu' or virt == 'kvm' or virt == 'bochs':
|
if virt in ('qemu', 'kvm', 'bochs'):
|
||||||
logging.info('Running in a VM guest, defaulting to QEMU/KVM via libvirt')
|
logging.info('Running in a VM guest, defaulting to QEMU/KVM via libvirt')
|
||||||
config['vm_provider'] = 'libvirt'
|
config['vm_provider'] = 'libvirt'
|
||||||
elif virt != 'none':
|
elif virt != 'none':
|
||||||
|
|
Loading…
Reference in New Issue