diff --git a/.gitignore b/.gitignore index 88f1ea2..63d41ae 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,6 @@ cython_debug/ #.idea/ *.pyc .vscode/settings.json + +# ignore local devcontainer settings +.devcontainer/* \ No newline at end of file diff --git a/src/fairscape_cli/utils/build_utils.py b/src/fairscape_cli/utils/build_utils.py index a37b1a7..71f7be7 100644 --- a/src/fairscape_cli/utils/build_utils.py +++ b/src/fairscape_cli/utils/build_utils.py @@ -317,13 +317,17 @@ def process_merkle_tree(crate_path: Path) -> bool: metadata_file = crate_path / "ro-crate-metadata.json" output_path = crate_path / "ro-crate-merkle-tree.json" - try: - tree = generate_merkle_tree(crate_path) - if tree is None: - return False - with open(output_path, 'w') as f: - json.dump(tree, f, indent=2) + try: + if output_path.exists(): + pass + else: + tree = generate_merkle_tree(crate_path) + if tree is None: + return False + else: + with open(output_path, 'w') as f: + json.dump(tree, f, indent=2) # Annotate root entity with the Merkle root hash with open(metadata_file, 'r') as f: