Skip to content

Commit

Permalink
[py-gt4py, py-icon4py] Renaming gt4py versions + Adding icon4py v0.0.…
Browse files Browse the repository at this point in the history
…3.1 to latest (#835)

* adding patched v0.0.3.1

* GitHub Action: Apply Pep8-formatting

* updating condition

* trying special case for v0.0.3

* GitHub Action: Apply Pep8-formatting

* Update package.py

* GitHub Action: Apply Pep8-formatting

* renaming gt4py versions

* testing new icon4py gt4py tags

* GitHub Action: Apply Pep8-formatting

* Update package.py

* GitHub Action: Apply Pep8-formatting

* Update package.py

* Update package.py

* adding test for gt4py 1.0.1.1b

* GitHub Action: Apply Pep8-formatting

* adding icon4py v0.0.8

* Update system_test.py

* Update package.py

* folder mapping for lower versions

* folder mapping

* GitHub Action: Apply Pep8-formatting

* temp test for dsl

* Update system_test.py

* Update package.py

* Pick parent dir for ver < 0.0.4

* GitHub Action: Apply Pep8-formatting

* Update package.py

* GitHub Action: Apply Pep8-formatting

* Update system_test.py

* Reverting repo/branch

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
abishekg7 and github-actions authored Oct 19, 2023
1 parent 3758ae9 commit 8829176
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 31 deletions.
30 changes: 20 additions & 10 deletions repos/c2sm/packages/icon/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,18 +586,28 @@ def configure_args(self):
config_vars['LOC_GT4PY'].append(self.spec['py-gt4py'].prefix)
config_vars['LOC_ICON4PY_BIN'].append(
self.spec['py-icon4py'].prefix)

config_vars['LOC_ICON4PY_ATM_DYN_ICONAM'].append(
self.spec['py-icon4py:atm_dyn_iconam'].headers.directories[0])
config_vars['LOC_ICON4PY_TOOLS'].append(
self.spec['py-icon4py:tools'].headers.directories[0])
if self.spec['py-icon4py'].version > Version("0.0.7"):
config_vars['LOC_ICON4PY_DIFFUSION'].append(
self.spec['py-icon4py:diffusion'].headers.directories[0])
config_vars['LOC_ICON4PY_INTERPOLATION'].append(
self.spec['py-icon4py:interpolation'].headers.
directories[0])
config_vars['LOC_ICON4PY_ADVECTION'].append(
self.spec['py-icon4py:advection'].headers.directories[0])

if self.spec['py-icon4py'].version < Version("0.0.4"):
config_vars['LOC_ICON4PY_UTILS'].append(
os.path.dirname(
self.spec['py-icon4py:utils'].headers.directories[0]))
else:
config_vars['LOC_ICON4PY_TOOLS'].append(
self.spec['py-icon4py:tools'].headers.directories[0])
if self.spec['py-icon4py'].version > Version("0.0.7"):
config_vars['LOC_ICON4PY_DIFFUSION'].append(
self.spec['py-icon4py:diffusion'].headers.
directories[0])
config_vars['LOC_ICON4PY_INTERPOLATION'].append(
self.spec['py-icon4py:interpolation'].headers.
directories[0])
if self.spec['py-icon4py'].version > Version("0.0.8"):
config_vars['LOC_ICON4PY_ADVECTION'].append(
self.spec['py-icon4py:advection'].headers.
directories[0])
config_vars['LOC_GRIDTOOLS'].append(
self.spec['py-gridtools-cpp:data'].headers.directories[0])
config_vars['GT4PYNVCFLAGS'] = config_vars['NVCFLAGS']
Expand Down
11 changes: 6 additions & 5 deletions repos/c2sm/packages/py-gt4py/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class PyGt4py(PythonPackage):
url = "[email protected]:GridTools/gt4py.git"

version('main', branch='main', git=url)
version('1.1.1', tag='icon4py_20230413', git=url)
version('1.1.2', tag='icon4py_20230621', git=url)
version('1.1.3', tag='icon4py_20230817', git=url)
version('1.1.4', tag='icon4py_20230926', git=url)
version('1.0.1.1', tag='icon4py_20230413', git=url)
version('1.0.1.1b', tag='icon4py_20230530', git=url)
version('1.0.1.2', tag='icon4py_20230621', git=url)
version('1.0.1.3', tag='icon4py_20230817', git=url)
version('1.0.1.4', tag='icon4py_20230926', git=url)

maintainers = ['samkellerhals']

Expand Down Expand Up @@ -60,7 +61,7 @@ class PyGt4py(PythonPackage):
# See: https://github.com/C2SM/spack-c2sm/issues/803
depends_on('[email protected]:2.9.2', type=('build', 'run'))

depends_on('[email protected]:', when="@1.1.3:", type=('build', 'run'))
depends_on('[email protected]:', when="@1.0.1.3:", type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:4.6', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
Expand Down
18 changes: 13 additions & 5 deletions repos/c2sm/packages/py-icon4py/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class PyIcon4py(PythonPackage):

version('main', branch='main', git=git)
version('0.0.3', tag='v0.0.3', git=git)
version('0.0.3.1', tag='v0.0.3.1', git=git)
version('0.0.4', tag='v0.0.4', git=git)
version('0.0.5', tag='v0.0.5', git=git)
version('0.0.6', tag='v0.0.6', git=git)
Expand Down Expand Up @@ -69,6 +70,16 @@ def headers(self):
version = self.spec.version

folder_mapping = {
ver('=0.0.3'): {
'atm_dyn_iconam': 'atm_dyn_iconam',
'utils':
'liskov' #utils will eventually map to parent directory of liskov
},
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.4'): {
'atm_dyn_iconam': 'atm_dyn_iconam',
'tools': 'icon4pytools'
Expand Down Expand Up @@ -103,10 +114,6 @@ def headers(self):
if len(query_parameters) > 1:
raise ValueError('Only one query parameter allowed')

if version == ver('=0.0.3') and len(query_parameters) == 1:
msg = 'Not implemented for version {0}'.format(version)
raise spack.error.NoHeadersError(msg)

folder_name = folder_mapping.get(version, {})

if not folder_name:
Expand Down Expand Up @@ -154,7 +161,8 @@ def install(self, pkg, spec, prefix):

pip = inspect.getmodule(pkg).pip

if self.spec.version == ver('=0.0.3'):
if self.spec.version == ver('=0.0.3') or self.spec.version == ver(
'=0.0.3.1'):
build_dirs = [
'common', 'pyutils', 'testutils', 'liskov', 'atm_dyn_iconam'
]
Expand Down
28 changes: 17 additions & 11 deletions test/system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,19 +645,22 @@ def test_install_default(self):
@pytest.mark.no_tsa # Irrelevant
class PyGt4pyTest(unittest.TestCase):

def test_install_version_1_1_1(self):
spack_install_and_test('py-gt4py @1.1.1')
def test_install_version_1_0_1_1(self):
spack_install_and_test('py-gt4py @1.0.1.1')

def test_install_version_1_1_2(self):
spack_install_and_test('py-gt4py @1.1.2')
def test_install_version_1_0_1_1b(self):
spack_install_and_test('py-gt4py @1.0.1.1b')

def test_install_version_1_0_1_2(self):
spack_install_and_test('py-gt4py @1.0.1.2')

@pytest.mark.no_daint # fails with ModuleNotFoundError: No module named 'dace'
@pytest.mark.no_balfrin # fails with ModuleNotFoundError: No module named 'dace'
def test_install_version_1_1_3(self):
spack_install_and_test('py-gt4py @1.1.3')
def test_install_version_1_0_1_3(self):
spack_install_and_test('py-gt4py @1.0.1.3')

def test_install_version_1_1_4(self):
spack_install_and_test('py-gt4py @1.1.4')
def test_install_version_1_0_1_4(self):
spack_install_and_test('py-gt4py @1.0.1.4')


class PyHatchlingTest(unittest.TestCase):
Expand All @@ -669,15 +672,18 @@ def test_install_default(self):
@pytest.mark.no_tsa # py-isort install fails with: No module named 'poetry'.
class PyIcon4pyTest(unittest.TestCase):

def test_install_version_0_0_3(self):
spack_install_and_test('py-icon4py @ 0.0.3.1 %gcc ^[email protected]')

def test_install_version_0_0_5(self):
spack_install_and_test('py-icon4py @ 0.0.5 %gcc ^[email protected]')
spack_install_and_test('py-icon4py @ 0.0.5 %gcc ^py-gt4py@1.0.1.1')

def test_install_version_0_0_6(self):
spack_install_and_test('py-icon4py @ 0.0.6 %gcc ^[email protected]')
spack_install_and_test('py-icon4py @ 0.0.6 %gcc ^py-gt4py@1.0.1.2')

def test_install_version_0_0_7(self):
spack_install_and_test(
'py-icon4py @ 0.0.7 %gcc ^[email protected] ^[email protected]')
'py-icon4py @ 0.0.7 %gcc ^py-gt4py@1.0.1.3 ^[email protected]')


class PyInflectionTest(unittest.TestCase):
Expand Down

0 comments on commit 8829176

Please sign in to comment.