Fix mutable params + compact names json

This commit is contained in:
relikd
2020-09-24 12:03:54 +02:00
parent 087bd5384b
commit 500f38b6b4
9 changed files with 102 additions and 108 deletions

View File

@@ -249,14 +249,14 @@ def enum_jsons(bundle_id):
yield fname, json.load(fp)
def appids_in_out(selection=['*']):
if selection != ['*']:
def appids_in_out(selection=None):
if selection and selection != ['*']:
return selection
return [os.path.basename(x) for x in glob.glob(path_out_app('*'))]
def appids_in_data(selection=['*']):
if selection != ['*']:
def appids_in_data(selection=None):
if selection and selection != ['*']:
return selection
global _all_data_bundle_ids
if not _all_data_bundle_ids:
@@ -287,6 +287,10 @@ def json_read(path):
return json.load(fp)
def json_safe_read(path, fallback=None):
return json_read(path) if file_exists(path) else fallback
def json_write(path, obj, pretty=False):
with open(path, 'w') as fp:
json.dump(obj, fp, indent=2 if pretty else None, sort_keys=pretty)