Skip to content

Commit

Permalink
Per #2562 and #2597, replace automated test logic that used manage_ex…
Browse files Browse the repository at this point in the history
…ternals to use component version lookup to get versions of METplotpy/METcalcpy/METdataio
  • Loading branch information
georgemccabe committed Nov 5, 2024
1 parent f12e3b9 commit 1221420
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions .github/jobs/get_use_case_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from metplus.util.string_manip import expand_int_string_to_list
from docker_utils import VERSION_EXT
from metplus import get_metplus_version
from metplus.component_versions import get_component_version

# path to METplus install location in Docker
METPLUS_DOCKER_LOC = '/metplus/METplus'
Expand Down Expand Up @@ -76,35 +77,33 @@ def handle_automation_env(host_name, reqs, work_dir):
else:
py_embed_arg = ''

# get METplus version to determine Externals file to use
# to get METplotpy/METcalcpy/METdataio
# get METplus version to determine which version of
# METplotpy/METcalcpy/METdataio to use
# If stable release, get main branch, otherwise get develop
is_stable_release = len(get_metplus_version().split('-')) == 1
externals_ext = '_stable.cfg' if is_stable_release else '.cfg'
metplus_version = get_metplus_version()

# if any metplotpy/metcalcpy keywords are in requirements list,
# add command to obtain and install METplotpy and METcalcpy
components = []
if any([item for item in PLOTCALC_KEYWORDS if item in str(reqs).lower()]):
ce_file = os.path.join(work_dir, '.github', 'parm',
f'Externals_metplotcalcpy{externals_ext}')
setup_env.extend((
f'cd {METPLUS_DOCKER_LOC}',
f'{work_dir}/manage_externals/checkout_externals -e {ce_file}',
f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METplotpy',
f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METcalcpy',
'cd -',
))
components.extend(('METplotpy', 'METcalcpy'))

# if metdataio is in requirements list, add command to obtain METdataio
if 'metdataio' in str(reqs).lower():
ce_file = os.path.join(work_dir, '.github', 'parm',
f'Externals_metdataio{externals_ext}')
components.append('METdataio')

setup_env.append(f'cd {METPLUS_DOCKER_LOC}')
for component in components:
version = get_component_version(input_component='METplus',
input_version=metplus_version,
output_component=component,
output_format='main_v{X}.{Y}',
get_dev=False)
setup_env.extend((
f'cd {METPLUS_DOCKER_LOC}',
f'{work_dir}/manage_externals/checkout_externals -e {ce_file}',
f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METdataio',
'cd -',
f'git clone https://github.com/dtcenter/{component} --branch {version}',
f'{python_path} -m pip install {component}',
))
setup_env.append('cd -')

# if metplus is in requirements list,
# add top of METplus repo to PYTHONPATH so metplus can be imported
Expand Down

0 comments on commit 1221420

Please sign in to comment.