Skip to content

Commit fa14193

Browse files
further apply_macros changes
1 parent f69986f commit fa14193

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

lfric_macros/apply_macros.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,16 +564,22 @@ def get_full_import_path(self, imp):
564564
"""
565565

566566
core_imp = os.path.join(self.core_source, imp)
567-
if os.path.exists(core_imp):
567+
if os.path.exists(core_imp) or os.path.exists(
568+
os.path.dirname(core_imp)
569+
):
568570
return core_imp
569571

570572
# Reinstate when using Jules Shared from Jules
571573
# jules_imp = os.path.join(self.jules_source, imp)
572-
# if os.path.exists(jules_imp):
574+
# if os.path.exists(jules_imp) or os.path.exists(
575+
# os.path.dirname(jules_imp)
576+
# ):
573577
# return jules_imp
574578

575579
apps_imp = os.path.join(self.root_path, imp)
576-
if os.path.exists(apps_imp):
580+
if os.path.exists(apps_imp) or os.path.exists(
581+
os.path.dirname(apps_imp)
582+
):
577583
return apps_imp
578584

579585
raise Exception(
@@ -612,7 +618,7 @@ def read_meta_imports(self, meta_dir, flag="import"):
612618
# Split the import line by '=' then take the rhs
613619
# Then remove the trailing '/HEAD'
614620
# Then prepend the path to the working copy
615-
imp = line.split("=", 1)[1].strip("/HEAD")
621+
imp = line.split("=", 1)[1].removesuffix("/HEAD")
616622
imp = self.get_full_import_path(imp)
617623
imports.append(imp)
618624
else:
@@ -1038,7 +1044,12 @@ def apply_macros_main(args):
10381044
"""
10391045

10401046
macro_object = ApplyMacros(
1041-
args.tag, args.cname, args.version, args.apps, args.core, args.jules
1047+
args["tag"],
1048+
args["cname"],
1049+
args["version"],
1050+
args["apps"],
1051+
args["core"],
1052+
args["jules"],
10421053
)
10431054

10441055
# Pre-process macros
@@ -1070,4 +1081,4 @@ def apply_macros_main(args):
10701081

10711082
if __name__ == "__main__":
10721083
args = parse_args()
1073-
apply_macros_main(args)
1084+
apply_macros_main(vars(args))

0 commit comments

Comments
 (0)