diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2022-07-13 01:45:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 19:45:24 -0400 |
commit | 7f2b5e8e570cc1c6f783af80de083bde7c1ffc8c (patch) | |
tree | e60261f7ce32012081911a09ecf7712005af813e /var/spack/repos/builtin/packages/gcc/package.py | |
parent | 6ceb274de035d42fc55822b2753a979355cd8af0 (diff) | |
download | spack-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/packages/gcc/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/gcc/package.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index fe621a5bde..392f3b5910 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -11,6 +11,7 @@ import sys from archspec.cpu import UnsupportedMicroarchitecture import llnl.util.tty as tty +from llnl.util.lang import classproperty import spack.platforms import spack.util.executable @@ -351,8 +352,8 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): build_directory = 'spack-build' - @property - def executables(self): + @classproperty + def executables(cls): names = [r'gcc', r'[^\w]?g\+\+', r'gfortran'] suffixes = [r'', r'-mp-\d+\.\d', r'-\d+\.\d', r'-\d+', r'\d\d'] return [r''.join(x) for x in itertools.product(names, suffixes)] |