diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 35466193..aeda879f 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -191,7 +191,7 @@ def check_tags(app, pattern): root_dir = build_dir / subdir paths = common.manifest_paths(root_dir, last_build.gradle) version, vercode, _package = common.parse_androidmanifests(paths, app) - if version == 'Unknown' or version == 'Ignore': + if version in ('Unknown', 'Ignore'): version = tag if vercode: logging.debug("Manifest exists in subdir '{0}'. Found version {1} ({2})" diff --git a/fdroidserver/common.py b/fdroidserver/common.py index e9056634..17b939d3 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -2616,7 +2616,7 @@ def get_apk_id_androguard(apkfile): if axml.getName() == 'manifest': break - elif _type == END_TAG or _type == TEXT or _type == END_DOCUMENT: + elif _type in (END_TAG, TEXT, END_DOCUMENT): raise RuntimeError('{path}: must be the first element in AndroidManifest.xml' .format(path=apkfile)) diff --git a/fdroidserver/import_subcommand.py b/fdroidserver/import_subcommand.py index e32a9f90..ec3b0036 100644 --- a/fdroidserver/import_subcommand.py +++ b/fdroidserver/import_subcommand.py @@ -142,7 +142,7 @@ def get_app_from_url(url): app.RepoType = 'git' app.SourceCode = url 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 if url.endswith('.git'): url = url[:-4] diff --git a/fdroidserver/init.py b/fdroidserver/init.py index c429f096..1fbba382 100644 --- a/fdroidserver/init.py +++ b/fdroidserver/init.py @@ -98,7 +98,7 @@ def main(): # exist, prompt the user using platform-specific default # and if the user leaves it blank, ignore and move on. default_sdk_path = '' - if sys.platform == 'win32' or sys.platform == 'cygwin': + if sys.platform in ('win32', 'cygwin'): p = os.path.join( os.getenv('USERPROFILE'), 'AppData', 'Local', 'Android', 'android-sdk' ) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index fe3a0874..11aa801e 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -108,7 +108,7 @@ def px_to_dpi(px): def get_icon_dir(repodir, density): - if density == '0' or density == '65534': + if density in ('0', '65534'): return os.path.join(repodir, "icons") else: return os.path.join(repodir, "icons-%s" % density) @@ -647,7 +647,7 @@ def _strip_and_copy_image(in_file, outpath): except Exception as e: logging.error(_("Failed copying {path}: {error}".format(path=in_file, error=e))) return - elif extension == 'jpg' or extension == 'jpeg': + elif extension in ('jpg', 'jpeg'): try: with open(in_file, 'rb') as fp: in_image = Image.open(fp) @@ -866,16 +866,16 @@ def copy_triple_t_store_metadata(apps): locale = segments[-2] 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', 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', 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', 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', os.path.join(root, f)) elif f == 'whatsnew': @@ -884,11 +884,11 @@ def copy_triple_t_store_metadata(apps): elif f == 'default.txt' and segments[-2] == 'release-notes': _set_localized_text_entry(app, locale, 'whatsNew', 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)) - 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)) - 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)) else: 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() for name in os.listdir(repodir): file_extension = common.get_file_extension(name) - if file_extension == 'apk' or file_extension == 'obb': + if file_extension in ('apk', 'obb'): continue filename = os.path.join(repodir, name) name_utf8 = name.decode() @@ -1405,8 +1405,10 @@ def scan_apk_androguard(apk, apkfile): if key not in item.attrib: continue feature = str(item.attrib[key]) - if feature != "android.hardware.screen.portrait" \ - and feature != "android.hardware.screen.landscape": + if feature not in ( + 'android.hardware.screen.portrait', + 'android.hardware.screen.landscape', + ): if feature.startswith("android.feature."): feature = feature[16:] required = item.attrib.get(xmlns + 'required') diff --git a/makebuildserver b/makebuildserver index 428dec50..cb4d1b92 100755 --- a/makebuildserver +++ b/makebuildserver @@ -616,7 +616,7 @@ if __name__ == '__main__': virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8') except subprocess.CalledProcessError: 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') config['vm_provider'] = 'libvirt' elif virt != 'none':