From 9b2c7b805a26421dca5e95cdf01a5b540c10136f Mon Sep 17 00:00:00 2001 From: Dominic Hofer <6570912+dominichofer@users.noreply.github.com> Date: Fri, 9 Aug 2024 20:42:11 +0200 Subject: [PATCH] py-icon4py: Remove 0.0.11 and 0.0.12 --- repo/packages/py-icon4py/package.py | 121 +++++++++------------------- test/system_test.py | 5 +- 2 files changed, 41 insertions(+), 85 deletions(-) diff --git a/repo/packages/py-icon4py/package.py b/repo/packages/py-icon4py/package.py index 22181a5bd4..d6bbfa1667 100644 --- a/repo/packages/py-icon4py/package.py +++ b/repo/packages/py-icon4py/package.py @@ -13,115 +13,76 @@ class PyIcon4py(PythonPackage): - """ICON4Py contains Python (GT4Py) implementations of ICON (inspired) + """ICON4Py contains Python (GT4Py) implementations of ICON (inspired) components for weather and climate models.""" - git = 'git@github.com:C2SM/icon4py.git' + git = "git@github.com:C2SM/icon4py.git" homepage = "https://github.com/C2SM/icon4py" - maintainers = ['agopal', 'samkellerhals'] + maintainers = ["agopal", "samkellerhals"] - version('main', branch='main') - version('0.0.12', tag='v0.0.12') - version('0.0.11', tag='v0.0.11') - version('0.0.10', tag='v0.0.10') + version("main", branch="main") + version("0.0.12", tag="v0.0.12") - depends_on('py-wheel', type='build') - depends_on('py-setuptools', type='build') + depends_on("py-wheel", type="build") + depends_on("py-setuptools", type="build") - depends_on('python@3.10:', type=('build', 'run')) - depends_on('py-tabulate@0.8.9:', type=('build', 'run')) + depends_on("python@3.10:", type=("build", "run")) + depends_on("py-tabulate@0.8.9:", type=("build", "run")) # TODO: push new version to Spack official - depends_on('py-fprettify@0.3.7:', type=('build', 'run')) - depends_on('py-gt4py', type=('build', 'run')) - depends_on('py-pytest', type=('build', 'run')) - depends_on('boost@1.73.0:', type=('build', 'run')) + depends_on("py-fprettify@0.3.7:", type=("build", "run")) + depends_on("py-gt4py", type=("build", "run")) + depends_on("py-pytest", type=("build", "run")) + depends_on("boost@1.73.0:", type=("build", "run")) def patch(self): - spack_pytest_ini = 'jenkins/spack/pytest.ini' + spack_pytest_ini = "jenkins/spack/pytest.ini" if os.path.exists(spack_pytest_ini): - fs.install(spack_pytest_ini, '.') + fs.install(spack_pytest_ini, ".") # cmake in unit-tests needs this path def setup_build_environment(self, env): - env.set("CMAKE_INCLUDE_PATH", self.spec['boost'].prefix.include) + env.set("CMAKE_INCLUDE_PATH", self.spec["boost"].prefix.include) def test(self): # check if all installed module can be imported super().test() # unit tests - python('-m', 'pytest', '-v', '-s', '-n', 'auto', '-m', - 'not slow_tests') + python("-m", "pytest", "-v", "-s", "-n", "auto", "-m", "not slow_tests") @property def headers(self): - '''Workaround to hide the details of the installation path, + """Workaround to hide the details of the installation path, i.e "lib/python3.10/site-packages/icon4py/atm_dyn_iconam" from upstream packages. It needs to be part of the "Spec" object, therefore choose the headers-function - ''' + """ query_parameters = self.spec.last_query.extra_parameters - version = self.spec.version - - folder_mapping = { - ver('=0.0.3.1'): { - 'atm_dyn_iconam': 'atm_dyn_iconam', - 'utils': - 'liskov' #utils will eventually map to parent directory of liskov - }, - ver('=0.0.9'): { - 'atm_dyn_iconam': 'dycore', - 'tools': 'icon4pytools', - 'diffusion': 'diffusion/stencils', - 'interpolation': 'interpolation/stencils', - 'advection': 'advection', - }, - ver('=0.0.10'): { - 'atm_dyn_iconam': 'dycore', - 'tools': 'icon4pytools', - 'diffusion': 'diffusion/stencils', - 'interpolation': 'interpolation/stencils', - 'advection': 'advection', - }, - ver('=0.0.11'): { - 'atm_dyn_iconam': 'dycore', - 'tools': 'icon4pytools', - 'diffusion': 'diffusion/stencils', - 'interpolation': 'interpolation/stencils', - 'advection': 'advection', - }, - ver('=main'): { - 'atm_dyn_iconam': 'dycore', - 'tools': 'icon4pytools', - 'diffusion': 'diffusion/stencils', - 'interpolation': 'interpolation/stencils', - 'advection': 'advection', - }, - } if len(query_parameters) > 1: - raise ValueError('Only one query parameter allowed') - - folder_name = folder_mapping.get(version, {}) - - if not folder_name: - return HeaderList([]) + raise ValueError("Only one query parameter allowed") + + folder_name = { + "atm_dyn_iconam": "dycore", + "tools": "icon4pytools", + "diffusion": "diffusion/stencils", + "interpolation": "interpolation/stencils", + "advection": "advection", + } for param, folder in folder_name.items(): if param in query_parameters: - return self._find_folder_and_add_dummy_header( - self.prefix, folder) + return self._find_folder_and_add_dummy_header(self.prefix, folder) return HeaderList([]) def _find_folder_and_add_dummy_header(self, prefix, name): folder = find(prefix, name) - headerlist = HeaderList(f'{folder[0]}/dummy.h') + headerlist = HeaderList(f"{folder[0]}/dummy.h") return headerlist class PythonPipBuilder(PythonPipBuilder): - def install(self, pkg, spec, prefix): """Install everything from build directory.""" @@ -132,8 +93,8 @@ def install(self, pkg, spec, prefix): raise SpecError( "'{}' package uses 'config_settings' which is only supported by " "pip 22.1+. Add the following line to the package to fix this:\n\n" - ' depends_on("py-pip@22.1:", type="build")'.format( - spec.name)) + ' depends_on("py-pip@22.1:", type="build")'.format(spec.name) + ) args.append("--config-settings={}={}".format(key, value)) @@ -148,17 +109,13 @@ def install(self, pkg, spec, prefix): args.append(".") pip = inspect.getmodule(pkg).pip - - if self.spec.version == ver('=0.0.3.1'): - build_dirs = [ - 'common', 'pyutils', 'testutils', 'liskov', 'atm_dyn_iconam' - ] - else: - build_dirs = [ - 'tools', 'model/atmosphere/dycore', - 'model/atmosphere/diffusion', 'model/atmosphere/advection', - 'model/common/' - ] + build_dirs = [ + "tools", + "model/atmosphere/dycore", + "model/atmosphere/diffusion", + "model/atmosphere/advection", + "model/common/", + ] for dir in build_dirs: with fs.working_dir(os.path.join(self.build_directory, dir)): diff --git a/test/system_test.py b/test/system_test.py index 6ec62b7781..9e7c49dac8 100644 --- a/test/system_test.py +++ b/test/system_test.py @@ -129,9 +129,8 @@ def test_install_py_gt4py_for_version(version, ): spack_install(f'py-gt4py @{version}') -@pytest.mark.parametrize("version", ['0.0.10', '0.0.11', '0.0.12']) -def test_install_py_icon4py_version_0_0_10(version, ): - spack_install(f'py-icon4py @{version}') +def test_install_py_icon4py(): + spack_install('py-icon4py') def test_install_py_hatchling_default():