From 927b1971827f2d7a1f03b2bce2c654e1e8aef62d Mon Sep 17 00:00:00 2001 From: bblay Date: Wed, 7 Jan 2026 09:36:43 +0000 Subject: [PATCH 1/7] - fix rebuild crash (exist_ok) - copy new files only - preserve timestamps in case of file system time differences --- build/extract/extract_science.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/extract/extract_science.py b/build/extract/extract_science.py index 042fe6f32..48380f590 100755 --- a/build/extract/extract_science.py +++ b/build/extract/extract_science.py @@ -79,13 +79,13 @@ 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) 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}" + copy_command = f"cp -r -u --preserve=timestamps {source_file} {dest_file}" run_command(copy_command) rmtree(tempdir) @@ -118,6 +118,8 @@ def parse_args() -> argparse.Namespace: def main(): args: argparse.Namespace = parse_args() + print('extract_science args:', args) + extract_lists: Dict = load_yaml(args.extract) dependencies: Dict = load_yaml(args.dependencies) From 6e59335f755caf9f54ac345d8fd8f9c0c968b7ea Mon Sep 17 00:00:00 2001 From: bblay Date: Wed, 7 Jan 2026 09:41:33 +0000 Subject: [PATCH 2/7] remove print --- build/extract/extract_science.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/extract/extract_science.py b/build/extract/extract_science.py index 48380f590..b8f862a08 100755 --- a/build/extract/extract_science.py +++ b/build/extract/extract_science.py @@ -118,8 +118,6 @@ def parse_args() -> argparse.Namespace: def main(): args: argparse.Namespace = parse_args() - print('extract_science args:', args) - extract_lists: Dict = load_yaml(args.extract) dependencies: Dict = load_yaml(args.dependencies) From d9df59055af670981170f4ae236176a888464cc1 Mon Sep 17 00:00:00 2001 From: bblay Date: Wed, 7 Jan 2026 09:50:04 +0000 Subject: [PATCH 3/7] probably better to use the python --- build/extract/extract_science.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/extract/extract_science.py b/build/extract/extract_science.py index b8f862a08..72306a30d 100755 --- a/build/extract/extract_science.py +++ b/build/extract/extract_science.py @@ -84,7 +84,7 @@ def extract_files(dependency: str, values: Dict, files: List[str], working: Path 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]}") + 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) From baf61ff61e979e169a022bd52f83a852bc330740 Mon Sep 17 00:00:00 2001 From: bblay Date: Wed, 7 Jan 2026 13:58:08 +0000 Subject: [PATCH 4/7] update contributors --- CONTRIBUTORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 50ca66db0..eff995091 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -7,4 +7,6 @@ | 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 | +| bblay-mo | Byron Blay | Met Office | 2026-01-07 | + | harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | \ No newline at end of file From cb0803f090575899c4b9e11e4e37e38ca0f5d7f3 Mon Sep 17 00:00:00 2001 From: bblay Date: Thu, 8 Jan 2026 09:37:37 +0000 Subject: [PATCH 5/7] comment --- build/extract/extract_science.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build/extract/extract_science.py b/build/extract/extract_science.py index 72306a30d..2a9aaf0a3 100755 --- a/build/extract/extract_science.py +++ b/build/extract/extract_science.py @@ -81,6 +81,7 @@ def extract_files(dependency: str, values: Dict, files: List[str], working: Path # make the working directory location 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 From 8eb15246a0ac8e152546058f06b26cc5e4d97dcb Mon Sep 17 00:00:00 2001 From: bblay Date: Thu, 8 Jan 2026 15:06:22 +0000 Subject: [PATCH 6/7] rebased onto main --- CONTRIBUTORS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index eff995091..607922fa4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -8,5 +8,4 @@ | yaswant | Yaswant Pradhan | Met Office | 2025-12-16 | | oakleybrunt | Oakley Brunt | Met Office | 2025-12-19 | | bblay-mo | Byron Blay | Met Office | 2026-01-07 | - -| harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | \ No newline at end of file +| harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | From 178601c4802c9531a96f2561af61b609ce5accd3 Mon Sep 17 00:00:00 2001 From: bblay Date: Fri, 9 Jan 2026 10:40:49 +0000 Subject: [PATCH 7/7] copyright and line length --- build/extract/extract_science.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/extract/extract_science.py b/build/extract/extract_science.py index 2a9aaf0a3..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 @@ -86,7 +92,8 @@ def extract_files(dependency: str, values: Dict, files: List[str], working: Path source_file = temp_dep / extract_file dest_file = working_dep / extract_file dest_file.parent.mkdir(parents=True, exist_ok=True) - copy_command = f"cp -r -u --preserve=timestamps {source_file} {dest_file}" + copy_command = \ + f"cp -r -u --preserve=timestamps {source_file} {dest_file}" run_command(copy_command) rmtree(tempdir) @@ -105,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",