diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2020-09-19 07:54:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 07:54:26 +0200 |
commit | fcb4dfc3077d2cb96c0fe84b6615581640637e3f (patch) | |
tree | be392d03f8323959b29a10f4b6c9d5a0e4e1c365 /var | |
parent | fff2f34de87d6f1a8018f7fe842846a5637850ca (diff) | |
download | spack-fcb4dfc3077d2cb96c0fe84b6615581640637e3f.tar.gz spack-fcb4dfc3077d2cb96c0fe84b6615581640637e3f.tar.bz2 spack-fcb4dfc3077d2cb96c0fe84b6615581640637e3f.tar.xz spack-fcb4dfc3077d2cb96c0fe84b6615581640637e3f.zip |
Ensure variant defaults are parsable from CLI. (#18661)
- Add a unit test to check if there are unparsable defaults
- Fix 'rust' and 'nsimd' variants
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/nsimd/package.py | 25 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/rust/package.py | 11 |
2 files changed, 16 insertions, 20 deletions
diff --git a/var/spack/repos/builtin/packages/nsimd/package.py b/var/spack/repos/builtin/packages/nsimd/package.py index 1d22be943e..f9706f834d 100644 --- a/var/spack/repos/builtin/packages/nsimd/package.py +++ b/var/spack/repos/builtin/packages/nsimd/package.py @@ -2,10 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack import * - - class Nsimd(CMakePackage): """NSIMD is a vectorization library that abstracts SIMD programming. It was designed to exploit the maximum power of processors @@ -28,11 +24,8 @@ class Nsimd(CMakePackage): 'NEON128', 'AARCH64', 'SVE', ), multi=False) - variant('optionals', - default=(), - description='Optional SIMD features', - values=('FMA', 'FP16'), - multi=True) + variant('optionals', values=any_combination_of('FMA', 'FP16'), + description='Optional SIMD features',) conflicts('simd=none', msg="SIMD instruction set not defined") @@ -56,10 +49,14 @@ class Nsimd(CMakePackage): python(*options) def cmake_args(self): + # Required SIMD argument simd = self.spec.variants['simd'].value - optionals = ';'.join(self.spec.variants['optionals'].value) - cmake_args = [ - "-DSIMD={0}".format(simd), - "-DSIMD_OPTIONALS={0}".format(optionals), - ] + cmake_args = ["-DSIMD={0}".format(simd)] + + # Optional SIMD instructions to be turned on explicitly + optionals_value = self.spec.variants['optionals'].value + if optionals_value != 'none': + optionals_arg = ';'.join(optionals_value) + cmake_args.append("-DSIMD_OPTIONALS={0}".format(optionals_arg)) + return cmake_args diff --git a/var/spack/repos/builtin/packages/rust/package.py b/var/spack/repos/builtin/packages/rust/package.py index abfd4e8e0b..e61e962013 100644 --- a/var/spack/repos/builtin/packages/rust/package.py +++ b/var/spack/repos/builtin/packages/rust/package.py @@ -2,8 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack import * from six import iteritems @@ -56,9 +54,7 @@ class Rust(Package): description='Install Rust source files' ) variant( - 'extra_targets', - default=(), - multi=True, + 'extra_targets', default='none', multi=True, description='Triples for extra targets to enable. For supported targets, see: https://doc.rust-lang.org/nightly/rustc/platform-support.html' ) @@ -502,7 +498,10 @@ class Rust(Package): ar = which('ar', required=True) - extra_targets = list(self.spec.variants['extra_targets'].value) + extra_targets = [] + if self.spec.variants['extra_targets'].value != 'none': + extra_targets = list(self.spec.variants['extra_targets'].value) + targets = [self.get_rust_target()] + extra_targets target_spec = 'target=[' + \ ','.join('"{0}"'.format(target) for target in targets) + ']' |