summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/multimethod
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-07-13 01:45:24 +0200
committerGitHub <noreply@github.com>2022-07-12 19:45:24 -0400
commit7f2b5e8e570cc1c6f783af80de083bde7c1ffc8c (patch)
treee60261f7ce32012081911a09ecf7712005af813e /var/spack/repos/builtin.mock/packages/multimethod
parent6ceb274de035d42fc55822b2753a979355cd8af0 (diff)
downloadspack-7f2b5e8e570cc1c6f783af80de083bde7c1ffc8c.tar.gz
spack-7f2b5e8e570cc1c6f783af80de083bde7c1ffc8c.tar.bz2
spack-7f2b5e8e570cc1c6f783af80de083bde7c1ffc8c.tar.xz
spack-7f2b5e8e570cc1c6f783af80de083bde7c1ffc8c.zip
`spack.repo.get()` can only be called on concrete specs (#31411)
The goal of this PR is to make clearer where we need a package object in Spack as opposed to a package class. We currently instantiate a lot of package objects when we could make do with a class. We should use the class when we only need metadata, and we should only instantiate and us an instance of `PackageBase` at build time. Modifications: - [x] Remove the `spack.repo.get` convenience function (which was used in many places, and not really needed) - [x] Use `spack.repo.path.get_pkg_class` wherever possible - [x] Try to route most of the need for `spack.repo.path.get` through `Spec.package` - [x] Introduce a non-data descriptor, that can be used as a decorator, to have "class level properties" - [x] Refactor unit tests that had to be modified to reduce code duplication - [x] `Spec.package` and `Repo.get` now require a concrete spec as input - [x] Remove `RepoPath.all_packages` and `Repo.all_packages`
Diffstat (limited to 'var/spack/repos/builtin.mock/packages/multimethod')
-rw-r--r--var/spack/repos/builtin.mock/packages/multimethod/package.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/var/spack/repos/builtin.mock/packages/multimethod/package.py b/var/spack/repos/builtin.mock/packages/multimethod/package.py
index 4f7cd6eca9..16af9198a0 100644
--- a/var/spack/repos/builtin.mock/packages/multimethod/package.py
+++ b/var/spack/repos/builtin.mock/packages/multimethod/package.py
@@ -19,6 +19,16 @@ class Multimethod(MultimethodBase):
homepage = 'http://www.example.com/'
url = 'http://www.example.com/example-1.0.tar.gz'
+ version('5.0', '0123456789abcdef0123456789abcdef')
+ version('4.0', '0123456789abcdef0123456789abcdef')
+ version('3.0', '0123456789abcdef0123456789abcdef')
+ version('2.0', '0123456789abcdef0123456789abcdef')
+ version('1.0', '0123456789abcdef0123456789abcdef')
+
+ variant('mpi', default=False, description='')
+
+ depends_on('mpi', when='+mpi')
+
#
# These functions are only valid for versions 1, 3, and 4.
#
@@ -76,9 +86,9 @@ class Multimethod(MultimethodBase):
def has_a_default(self):
return 'gcc'
- @when('%intel')
+ @when('%clang')
def has_a_default(self):
- return 'intel'
+ return 'clang'
#
# Make sure we can switch methods on different target