1- #!/usr/bin/env python3
1+ #!/usr/bin/env python
22##############################################################################
33# (c) Crown copyright 2024 Met Office. All rights reserved.
44# The file LICENCE, distributed with this code, contains details of the terms
@@ -249,9 +249,10 @@ def __init__(
249249 self ,
250250 tag : str ,
251251 cname : str | None ,
252- version : str ,
252+ version : str | None ,
253253 apps : Path ,
254254 core : Path ,
255+ jules : Path | None = None ,
255256 testing : bool = False ,
256257 ) -> None :
257258 self .tag : str = tag
@@ -267,7 +268,8 @@ def __init__(
267268 self .root_path : Path = apps
268269 else :
269270 self .root_path : Path = get_root_path (apps )
270- self .core_source : Path = self .get_dependency_paths (core )
271+ self .core_source : Path = self .get_dependency_paths (core , "lfric_core" )
272+ self .jules_source : Path = self .get_dependency_paths (jules , "jules" )
271273 self .set_rose_meta_path ()
272274 if version is None :
273275 self .version : str = re .search (r".*vn(\d+\.\d+)(_.*)?" , tag ).group (1 )
@@ -286,13 +288,15 @@ def __init__(
286288
287289 def set_rose_meta_path (self ) -> None :
288290 """
289- Set up the ROSE_META_PATH environment variable in order to use the Core
290- metadata. We also add the clone root path as this should allow the script to be
291- run from anywhere.
291+ Set up the ROSE_META_PATH environment variable in order to use the Core and
292+ Jules metadata. We also add the clone root path as this should allow the script
293+ to be run from anywhere.
292294 Edit 02/2026 - remove backwards compatibility support for pre central-metadata
293295 """
294296 rose_meta_path : str = (
295- f"{ self .root_path / 'rose-meta' } :{ self .core_source / 'rose-meta' } "
297+ f"{ self .root_path / 'rose-meta' } :"
298+ f"{ self .core_source / 'rose-meta' } :"
299+ f"{ self .jules_source / 'rose-meta' } "
296300 )
297301 os .environ ["ROSE_META_PATH" ] = rose_meta_path
298302
@@ -321,24 +325,23 @@ def parse_application_section(self, meta_dir: Path) -> Path:
321325 # Get Working Copy Functions
322326 ############################################################################
323327
324- def get_dependency_paths (self , source : str | None ) -> Path :
328+ def get_dependency_paths (self , source : str | None , repo : str ) -> Path :
325329 """
326- Parse the core command line arguments to get the path to a git clone.
330+ Parse the core/jules command line arguments to get the path to a git clone.
327331 If the source isn't defined, first populate the source by reading the
328332 dependencies.yaml file.
329333 If the source is a remote GitHub source clone it to a temporary location
330334 Inputs:
331335 - source, The command line argument for the source. If not set this will be
332336 None
337+ - repo, The name of the repository to clone
333338 Outputs:
334339 - The path to the source working copy to use
335340 """
336341
337- repo = "lfric_core"
338-
339342 # If source is None then read the dependencies.yaml file for the source
340343 if source is None :
341- source , ref = self .read_dependencies ()
344+ source , ref = self .read_dependencies (repo )
342345 if ":" in str (source ):
343346 source_path = Path (source .split (":" )[1 ]).expanduser ()
344347 else :
@@ -361,7 +364,7 @@ def get_dependency_paths(self, source: str | None) -> Path:
361364 source = self .git_clone_temp (source , ref , repo )
362365 return source
363366
364- def read_dependencies (self , repo : str = "lfric_core" ) -> tuple [str , str ]:
367+ def read_dependencies (self , repo : str ) -> tuple [str , str ]:
365368 """
366369 Read through the dependencies.yaml file for the source of the repo defined
367370 by repo. Uses self.root_path to locate the dependencies.yaml file.
@@ -1033,14 +1036,10 @@ def preprocess_macros(self, nproc: int) -> None:
10331036 if exception is not None :
10341037 executor .shutdown (wait = False , cancel_futures = True )
10351038 raise exception
1036- print (
1037- "[INFO] Processed macro successfully written to "
1038- f"{
1039- self .parse_application_section (
1040- meta_order [write_tasks .index (task )]
1041- )
1042- } "
1039+ print_val = self .parse_application_section (
1040+ meta_order [write_tasks .index (task )]
10431041 )
1042+ print (f"[INFO] Processed macro successfully written to { print_val } " )
10441043
10451044 ############################################################################
10461045 # Upgrade Apps Functions
@@ -1265,7 +1264,15 @@ def parse_args() -> argparse.Namespace:
12651264 "--core" ,
12661265 default = None ,
12671266 help = "The LFRic Core source being used."
1268- "Either a path to a working copy or a git source."
1267+ "Either a path to a local clone or a github source."
1268+ "If not set, will be read from the dependencies.yaml" ,
1269+ )
1270+ parser .add_argument (
1271+ "-j" ,
1272+ "--jules" ,
1273+ default = None ,
1274+ help = "The Jules source being used."
1275+ "Either a path to a local clone or a github source."
12691276 "If not set, will be read from the dependencies.yaml" ,
12701277 )
12711278 parser .add_argument (
@@ -1280,14 +1287,15 @@ def apply_macros_main(
12801287 version : str | None = None ,
12811288 apps : Path = Path ("." ).absolute (),
12821289 core : str | None = None ,
1290+ jules : str | None = None ,
12831291) -> None :
12841292 """
12851293 Main function for this program
12861294 """
12871295
12881296 check_environment ()
12891297
1290- macro_object : ApplyMacros = ApplyMacros (tag , cname , version , apps , core )
1298+ macro_object : ApplyMacros = ApplyMacros (tag , cname , version , apps , core , jules )
12911299
12921300 # Pre-process macros
12931301 banner_print ("Pre-Processing Macros" )
@@ -1316,4 +1324,6 @@ def apply_macros_main(
13161324
13171325if __name__ == "__main__" :
13181326 args = parse_args ()
1319- apply_macros_main (args .tag , args .cname , args .version , args .apps , args .core )
1327+ apply_macros_main (
1328+ args .tag , args .cname , args .version , args .apps , args .core , args .jules
1329+ )
0 commit comments