diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 50ca66db0..607922fa4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -7,4 +7,5 @@ | mo-marqh | mark Hedley | Met Office | 2025-12-11 | | yaswant | Yaswant Pradhan | Met Office | 2025-12-16 | | oakleybrunt | Oakley Brunt | Met Office | 2025-12-19 | -| harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | \ No newline at end of file +| bblay-mo | Byron Blay | Met Office | 2026-01-07 | +| harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | diff --git a/build/extract/extract_science.py b/build/extract/extract_science.py index 042fe6f32..1f7de4ba3 100755 --- a/build/extract/extract_science.py +++ b/build/extract/extract_science.py @@ -1,3 +1,8 @@ +############################################################################## +# (c) Crown copyright Met Office. All rights reserved. +# The file LICENCE, distributed with this code, contains details of the terms +# under which the code may be used. +############################################################################## import argparse import subprocess import os @@ -58,7 +63,8 @@ def clone_dependency(values: Dict, temp_dep: Path) -> None: run_command(command) -def extract_files(dependency: str, values: Dict, files: List[str], working: Path): +def extract_files( + dependency: str, values: Dict, files: List[str], working: Path): """ Clone the dependency to a temporary location Then copy the desired files to the working directory @@ -79,13 +85,15 @@ def extract_files(dependency: str, values: Dict, files: List[str], working: Path working_dep = working / dependency # make the working directory location - working_dep.mkdir(parents=True) + working_dep.mkdir(parents=True, exist_ok=True) + # copy new and updated files for extract_file in files: source_file = temp_dep / extract_file dest_file = working_dep / extract_file - run_command(f"mkdir -p {dest_file.parents[0]}") - copy_command = f"cp -r {source_file} {dest_file}" + dest_file.parent.mkdir(parents=True, exist_ok=True) + copy_command = \ + f"cp -r -u --preserve=timestamps {source_file} {dest_file}" run_command(copy_command) rmtree(tempdir) @@ -104,7 +112,8 @@ def parse_args() -> argparse.Namespace: help="The dependencies file for the apps working copy.", ) parser.add_argument( - "-w", "--working", default=".", help="Location to perform extract steps in." + "-w", "--working", default=".", + help="Location to perform extract steps in." ) parser.add_argument( "-e",