Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional metadata field for dynamic constituent routine #13

Merged
merged 9 commits into from
Mar 1, 2024
Merged
13 changes: 11 additions & 2 deletions scripts/ccpp_capgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,17 @@ def capgen(run_env, return_db=False):
# Pull out the dynamic constituent routines, if any
dyn_const_dict = {}
for table in scheme_tdict:
if scheme_tdict[table].dyn_const_routine is not None:
dyn_const_dict[table] = scheme_tdict[table].dyn_const_routine
routine_name = scheme_tdict[table].dyn_const_routine
if routine_name is not None:
if routine_name not in dyn_const_dict.values():
dyn_const_dict[table] = scheme_tdict[table].dyn_const_routine
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
dyn_const_dict[table] = scheme_tdict[table].dyn_const_routine
dyn_const_dict[table] = routine_name

Copy link
Owner Author

Choose a reason for hiding this comment

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

nice catch! fixed.

else:
# dynamic constituent routines must have unique names
scheme_name = list(dyn_const_dict.keys())[list(dyn_const_dict.values()).index(routine_name)]
errmsg = f"ERROR: Dynamic constituent routine names must be unique. Cannot add " \
f"{routine_name} for {table}. Routine already exists in {scheme_name}. "
raise CCPPError(errmsg)
# end if
# end if
# end for
if run_env.verbose:
Expand Down
Loading
Loading