From c6fc4a6842ec6754d4afd6b7c2d4aa67657b3b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20J=C3=A4hn?= Date: Tue, 19 Sep 2023 09:27:30 +0200 Subject: [PATCH] Add flexpart-cosmo (#742) --- repos/c2sm/packages/flexpart-cosmo/package.py | 51 +++++++++++++++++++ test/integration_test.py | 7 +++ test/system_test.py | 7 +++ 3 files changed, 65 insertions(+) create mode 100644 repos/c2sm/packages/flexpart-cosmo/package.py diff --git a/repos/c2sm/packages/flexpart-cosmo/package.py b/repos/c2sm/packages/flexpart-cosmo/package.py new file mode 100644 index 0000000000..283c4b203a --- /dev/null +++ b/repos/c2sm/packages/flexpart-cosmo/package.py @@ -0,0 +1,51 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# +from spack import * +from distutils.dir_util import copy_tree +from llnl.util.filesystem import working_dir + + +class FlexpartCosmo(MakefilePackage): + """flexpart is a Lagrangian dispersion model""" + + homepage = 'https://github.com/C2SM-RCM/flexpart' + git = 'ssh://git@github.com/C2SM-RCM/flexpart.git' + + version('main', branch='main') + + depends_on('eccodes +fortran') + depends_on('netcdf-fortran') + + conflicts('%gcc@:10') + conflicts('%nvhpc') + conflicts('%pgi') + conflicts('%cce') + + build_directory = 'src' + + makefile_file = "Makefile.spack" + + @property + def build_targets(self): + return ['ncf=yes', 'VERBOSE=1'] + + def setup_build_environment(self, env): + env.set('GRIB_API', self.spec['eccodes'].prefix) + env.set('NETCDF', self.spec['netcdf-fortran'].prefix) + + def build(self, spec, prefix): + + with working_dir(self.build_directory): + make('-f', self.makefile_file) + + def install(self, spec, prefix): + mkdir(prefix.bin) + mkdir(prefix.share) + mkdir(prefix.share + '/test/') + mkdir(prefix.share + '/options/') + copy_tree('options/', prefix.share + '/options/') + install('bin/FLEXPART', prefix.bin) diff --git a/test/integration_test.py b/test/integration_test.py index 0f5cd6c84f..7f894704c4 100644 --- a/test/integration_test.py +++ b/test/integration_test.py @@ -79,6 +79,9 @@ def test_fdb(self): def test_fdb_fortran(self): spack_info('fdb-fortran') + def test_flexpart_cosmo(self): + spack_info('flexpart-cosmo') + def test_flexpart_fdb(self): spack_info('flexpart-fdb') @@ -286,6 +289,10 @@ def test_fdb(self): def test_fdb_fortran(self): spack_spec('fdb-fortran') + @pytest.mark.no_tsa # No compatible compiler available + def test_flexpart_cosmo(self): + spack_spec('flexpart-cosmo') + def test_flexpart_fdb(self): spack_spec('flexpart-fdb') diff --git a/test/system_test.py b/test/system_test.py index 62efcc183a..f10d111ea0 100644 --- a/test/system_test.py +++ b/test/system_test.py @@ -346,6 +346,13 @@ def test_install_latest(self): spack_install_and_test('flexpart-ifs @meteoswiss-10') +@pytest.mark.no_tsa # No one uses spack for flexpart-cosmo on Tsa +class FlexpartCosmoTest(unittest.TestCase): + + def test_install(self): + spack_install_and_test('flexpart-cosmo') + + class GridToolsTest(unittest.TestCase): def test_install_version_1_1_3_gcc(self):