From d904c57d2be9699597364ca802d1c4944a23fc88 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Wed, 2 Sep 2020 11:07:10 -0400 Subject: [PATCH] Flibcpp: update version (#18448) Update available versions and add Fortran check --- .../repos/builtin/packages/flibcpp/package.py | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/var/spack/repos/builtin/packages/flibcpp/package.py b/var/spack/repos/builtin/packages/flibcpp/package.py index 2e50100d4a..01658ba2ee 100644 --- a/var/spack/repos/builtin/packages/flibcpp/package.py +++ b/var/spack/repos/builtin/packages/flibcpp/package.py @@ -15,6 +15,10 @@ class Flibcpp(CMakePackage): url = "https://github.com/swig-fortran/flibcpp/archive/v0.3.1.tar.gz" version('master', branch='master') + version('0.5.1', sha256='76db24ce7893f19ab97ea7260c39490ae1bd1e08a4cc5111ad7e70525a916993') + version('0.5.0', sha256='94204198304ba4187815431859e5958479fa651a6f06f460b099badbf50f16b2') + version('0.4.1', sha256='5c9a11af391fcfc95dd11b95338cff19ed8104df66d42b00ae54f6cde4da5bdf') + version('0.4.0', sha256='ccb0acf58a4480977fdb3c62a0bd267297c1dfa687a142ea8822474c38aa322b') version('0.3.1', sha256='871570124122c18018478275d5040b4b787d1966e50ee95b634b0b5e0cd27e91') variant('doc', default=False, description='Build and install documentation') @@ -27,18 +31,19 @@ class Flibcpp(CMakePackage): depends_on('swig@fortran', type='build', when="+swig") depends_on('py-sphinx', type='build', when="+doc") + @run_before('cmake') + def die_without_fortran(self): + # Until we can pass compiler requirements through virtual + # dependencies, explicitly check for Fortran compiler instead of + # waiting for configure error. + if (self.compiler.f77 is None) or (self.compiler.fc is None): + raise InstallError('Flibcpp requires a Fortran compiler') + def cmake_args(self): - spec = self.spec - - def hasopt(key): - return "ON" if ("+" + key) in spec else "OFF" - - testopt = "ON" if self.run_tests else "OFF" - opts = [('BUILD_SHARED_LIBS', hasopt('shared')), - ('BUILD_TESTING', testopt), - ('FLIBCPP_BUILD_DOCS', hasopt('doc')), - ('FLIBCPP_BUILD_EXAMPLES', testopt)] - fstd = spec.variants['fstd'].value - opts.append(('FLIBCPP_FORTRAN_STD', fstd)) - - return ['-D{0}={1}'.format(k, v) for (k, v) in opts] + return [ + self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), + self.define_from_variant('FLIBCPP_BUILD_DOCS', 'doc'), + self.define_from_variant('FLIBCPP_FORTRAN_STD', 'fstd'), + self.define('BUILD_TESTING', bool(self.run_tests)), + self.define('FLIBCPP_BUILD_EXAMPLES', bool(self.run_tests)), + ]