-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py-icon4py: Remove 0.0.11 and 0.0.12
- Loading branch information
1 parent
e85cd77
commit 9b2c7b8
Showing
2 changed files
with
41 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = '[email protected]:C2SM/icon4py.git' | ||
git = "[email protected]: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('[email protected]:', type=('build', 'run')) | ||
depends_on('[email protected]:', type=('build', 'run')) | ||
depends_on("[email protected]:", type=("build", "run")) | ||
depends_on("[email protected]:", type=("build", "run")) | ||
# TODO: push new version to Spack official | ||
depends_on('[email protected]:', type=('build', 'run')) | ||
depends_on('py-gt4py', type=('build', 'run')) | ||
depends_on('py-pytest', type=('build', 'run')) | ||
depends_on('[email protected]:', type=('build', 'run')) | ||
depends_on("[email protected]:", type=("build", "run")) | ||
depends_on("py-gt4py", type=("build", "run")) | ||
depends_on("py-pytest", type=("build", "run")) | ||
depends_on("[email protected]:", 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("[email protected]:", type="build")'.format( | ||
spec.name)) | ||
' depends_on("[email protected]:", 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)): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters