Skip to content

Commit

Permalink
Merge pull request #21 from amilsted/lazymeta
Browse files Browse the repository at this point in the history
Only write meta if changed
  • Loading branch information
cjdoris authored May 15, 2024
2 parents d9895f4 + 6dfa2a9 commit 6ceeb7c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/juliapkg/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def save_meta(meta):
assert meta.get("meta_version") == META_VERSION
fn = STATE["meta"]
os.makedirs(os.path.dirname(fn), exist_ok=True)
if os.path.exists(fn):
with open(fn) as fp:
old_meta_json = fp.read()
meta_json = json.dumps(meta)
if meta_json == old_meta_json:
# No need to write out if nothing changed
return
with open(fn, "w") as fp:
json.dump(meta, fp)

Expand Down

0 comments on commit 6ceeb7c

Please sign in to comment.