Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| bblay-mo | Byron Blay | Met Office | 2026-01-07 |
| harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 |
19 changes: 14 additions & 5 deletions build/extract/extract_science.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is almost certainly redundant, so we could remove it instead of fixing it.


# 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)
Expand All @@ -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",
Expand Down