Skip to content

Commit c10c876

Browse files
authored
Update release script to cope with JULES shared metadata (#99)
* Update release script to cope with JULES shared metadata * Run black * change to tuple
1 parent efdcd06 commit c10c876

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

lfric_macros/release_lfric.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,18 @@ def set_dependency_path(args):
9999
f.write("".join(x for x in lines))
100100

101101

102-
def find_meta_dirs(paths):
102+
def find_meta_dirs(paths, exclude_dirs=()):
103103
"""
104104
Return a set of rose-metadata directories that can be found in the apps and
105105
core sources. Done by seaching for rose-meta.conf files. Records the parent
106106
directory of the current one, as rose-meta.conf files end up in HEAD/vnX.Y
107107
directories.
108108
"""
109109

110-
print("[INFO] Finding rose metadata directories")
111-
112110
dirs = set()
113111
for path in paths:
112+
print("[INFO] Finding rose metadata directories in", path)
114113
for dirpath, dirnames, filenames in os.walk(path):
115-
exclude_dirs = [".svn", "rose-stem", "integration-test"]
116114
dirnames[:] = [d for d in dirnames if d not in exclude_dirs]
117115
if "rose-meta.conf" in filenames:
118116
dirs.add(os.path.dirname(dirpath))
@@ -407,7 +405,22 @@ def main():
407405

408406
set_dependency_path(args)
409407

410-
meta_dirs = find_meta_dirs([args.apps, args.core])
408+
# Find all metadata directories, excluing jules shared and lfric inputs as these have metadata but no macros.
409+
exclude_dirs = (
410+
".svn",
411+
"rose-stem",
412+
"integration-test",
413+
"lfric-jules-shared",
414+
"lfricinputs",
415+
)
416+
meta_dirs = find_meta_dirs([args.apps, args.core], exclude_dirs)
417+
418+
# Find JULES shared metadata directories and combine with all other metadirs for where they are handled differently
419+
jules_meta_path = os.path.join(
420+
args.apps, "interfaces", "jules_interface", "rose-meta", "lfric-jules-shared"
421+
)
422+
jules_shared_meta_dirs = find_meta_dirs([jules_meta_path])
423+
meta_dirs_plus_jules = meta_dirs.union(jules_shared_meta_dirs)
411424

412425
update_version_number(args)
413426

@@ -426,7 +439,7 @@ def main():
426439
)
427440
print("\n[INFO] Successfully upgraded apps")
428441

429-
copy_head_meta(meta_dirs, args)
442+
copy_head_meta(meta_dirs_plus_jules, args)
430443

431444
update_meta_import_path(meta_dirs, args)
432445

0 commit comments

Comments
 (0)