mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
update: test if options is instantated before using attributes
This makes it possible to use process_apks(), get_cache(), and anything calling disabled_algorithms_allowed() as an API without having to set options up beforehand.
This commit is contained in:
parent
790b5a2888
commit
3c64996089
@ -123,7 +123,9 @@ def get_all_icon_dirs(repodir):
|
||||
|
||||
|
||||
def disabled_algorithms_allowed():
|
||||
return options.allow_disabled_algorithms or config['allow_disabled_algorithms']
|
||||
return ((options is not None and options.allow_disabled_algorithms)
|
||||
or (config is not None and config['allow_disabled_algorithms'])
|
||||
or common.default_config['allow_disabled_algorithms'])
|
||||
|
||||
|
||||
def status_update_json(apps, apks):
|
||||
@ -521,7 +523,7 @@ def get_cache():
|
||||
"""
|
||||
apkcachefile = get_cache_file()
|
||||
ada = disabled_algorithms_allowed()
|
||||
if not options.clean and os.path.exists(apkcachefile):
|
||||
if options is not None and not options.clean and os.path.exists(apkcachefile):
|
||||
with open(apkcachefile) as fp:
|
||||
apkcache = json.load(fp, object_pairs_hook=collections.OrderedDict)
|
||||
if apkcache.get("METADATA_VERSION") != METADATA_VERSION \
|
||||
@ -1778,7 +1780,7 @@ def process_apks(apkcache, repodir, knownapks, use_date_from_apk=False):
|
||||
|
||||
for icon_dir in get_all_icon_dirs(repodir):
|
||||
if os.path.exists(icon_dir):
|
||||
if options.clean:
|
||||
if options is not None and options.clean:
|
||||
shutil.rmtree(icon_dir)
|
||||
os.makedirs(icon_dir)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user