diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2021-02-23 04:09:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 19:09:43 -0800 |
commit | 7226bd64dc3b46a1ed361f1e9d7fb4a2a5b65200 (patch) | |
tree | 67868cdf09b469c2669653ae46c40f3424d34cfa /var | |
parent | 56e57769bde417366a8aa2273e158a6841d9d9e5 (diff) | |
download | spack-7226bd64dc3b46a1ed361f1e9d7fb4a2a5b65200.tar.gz spack-7226bd64dc3b46a1ed361f1e9d7fb4a2a5b65200.tar.bz2 spack-7226bd64dc3b46a1ed361f1e9d7fb4a2a5b65200.tar.xz spack-7226bd64dc3b46a1ed361f1e9d7fb4a2a5b65200.zip |
Improve error message for inconsistencies in package.py (#21811)
* Improve error message for inconsistencies in package.py
Sometimes directives refer to variants that do not exist.
Make it such that:
1. The name of the variant
2. The name of the package which is supposed to have
such variant
3. The name of the package making this assumption
are all printed in the error message for easier debugging.
* Add unit tests
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin.mock/packages/wrong-variant-in-conflicts/package.py | 13 | ||||
-rw-r--r-- | var/spack/repos/builtin.mock/packages/wrong-variant-in-depends-on/package.py | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/wrong-variant-in-conflicts/package.py b/var/spack/repos/builtin.mock/packages/wrong-variant-in-conflicts/package.py new file mode 100644 index 0000000000..7a53904f60 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/wrong-variant-in-conflicts/package.py @@ -0,0 +1,13 @@ +# Copyright 2013-2021 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) +class WrongVariantInConflicts(Package): + """This package has a wrong variant spelled in a conflict.""" + + homepage = "http://www.example.com" + url = "http://www.example.com/b-1.0.tar.gz" + + version('1.0', '0123456789abcdef0123456789abcdef') + + conflicts('+foo', when='@1.0') diff --git a/var/spack/repos/builtin.mock/packages/wrong-variant-in-depends-on/package.py b/var/spack/repos/builtin.mock/packages/wrong-variant-in-depends-on/package.py new file mode 100644 index 0000000000..628a761c7c --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/wrong-variant-in-depends-on/package.py @@ -0,0 +1,13 @@ +# Copyright 2013-2021 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) +class WrongVariantInDependsOn(Package): + """This package has a wrong variant spelled in a depends_on.""" + + homepage = "http://www.example.com" + url = "http://www.example.com/b-1.0.tar.gz" + + version('1.0', '0123456789abcdef0123456789abcdef') + + depends_on('b+doesnotexist') |