From e44de970f8b6b713955417c9e0b514bef41bfa81 Mon Sep 17 00:00:00 2001 From: Paul Adamson <5460406+padamson@users.noreply.github.com> Date: Tue, 10 Aug 2021 02:05:26 -0400 Subject: uqtk: add pyqutk variant to uqtk (#25298) Co-authored-by: Massimiliano Culpo --- var/spack/repos/builtin/packages/uqtk/package.py | 29 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/uqtk/package.py b/var/spack/repos/builtin/packages/uqtk/package.py index 846b5bbfa7..43b0749811 100644 --- a/var/spack/repos/builtin/packages/uqtk/package.py +++ b/var/spack/repos/builtin/packages/uqtk/package.py @@ -18,11 +18,21 @@ class Uqtk(CMakePackage): version('3.1.0', sha256='56ecd3d13bdd908d568e9560dc52cc0f66d7bdcdbe64ab2dd0147a7cf1734f97') version('3.0.4', sha256='0a72856438134bb571fd328d1d30ce3d0d7aead32eda9b7fb6e436a27d546d2e') + variant('pyuqtk', default=True, + description='Compile Python scripts and interface to C++ libraries') + depends_on('expat') depends_on('sundials', when='@3.1.0:') depends_on('blas', when='@3.1.0:') depends_on('lapack', when='@3.1.0:') + extends('python', when='+pyuqtk') + depends_on('py-numpy', when='+pyuqtk') + depends_on('py-scipy', when='+pyuqtk') + depends_on('py-matplotlib', when='+pyuqtk') + depends_on('py-pymc3', when='+pyuqtk') + depends_on('swig', when='+pyuqtk') + # Modify the process of directly specifying blas/lapack # as the library name. patch('remove_unique_libname.patch', when='@3.1.0:') @@ -38,8 +48,19 @@ class Uqtk(CMakePackage): lapack_libs = spec['lapack'].libs.joined(';') blas_libs = spec['blas'].libs.joined(';') - return [ - '-DCMAKE_SUNDIALS_DIR={0}'.format(spec['sundials'].prefix), - '-DLAPACK_LIBRARIES={0}'.format(lapack_libs), - '-DBLAS_LIBRARIES={0}'.format(blas_libs) + args = [ + self.define('CMAKE_SUNDIALS_DIR', spec['sundials'].prefix), + self.define('LAPACK_LIBRARIES', lapack_libs), + self.define('BLAS_LIBRARIES', blas_libs), + self.define_from_variant('PyUQTk', 'pyuqtk') ] + + return args + + def setup_run_environment(self, env): + if '+pyuqtk' in self.spec: + env.prepend_path('PYTHONPATH', self.prefix) + env.prepend_path('PYTHONPATH', '{0}/PyUQTk'.format(self.prefix)) + env.prepend_path('LD_LIBRARY_PATH', '{0}/PyUQTk/'.format(self.prefix)) + env.set('UQTK_SRC', self.prefix) + env.set('UQTK_INS', self.prefix) -- cgit v1.2.3-70-g09d2