Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/asv
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice committed Nov 26, 2021
2 parents 73625e9 + 641b03b commit 7b8a501
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .sync-zenodo-metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Synchronize authors and contributor metadata.
This script synchronizes the metadata provided in the CITATION.cff and
Expand Down Expand Up @@ -80,16 +80,17 @@ def sync(ctx, in_place=False, check=True):
for key in ("version", "keywords"):
zenodo_updated[key] = citation[key]

modified = json.dumps(zenodo, sort_keys=True) != json.dumps(
zenodo_updated, sort_keys=True
)
def dump_json_utf8(content):
return json.dumps(content, sort_keys=True, indent=4, ensure_ascii=False)

modified = dump_json_utf8(zenodo) != dump_json_utf8(zenodo_updated)
if modified:
json_data = dump_json_utf8(zenodo_updated)
if in_place:
with open(".zenodo.json", "wb") as file:
json_data = json.dumps(zenodo_updated, indent=4, sort_keys=True)
file.write((json_data + "\n").encode("utf-8"))
else:
click.echo(json.dumps(zenodo_updated, indent=4, sort_keys=True))
click.echo(json_data)
if check:
ctx.exit(1)
else:
Expand Down

0 comments on commit 7b8a501

Please sign in to comment.