spack/share/spack
Massimiliano Culpo ff04d1bfc1
Use the non-deprecated MetaPathFinder interface (#29745)
* Extract the MetaPathFinder and Loaders for packages in their own classes

https://peps.python.org/pep-0451/

Currently, RepoPath and Repo implement the (deprecated) interface of
MetaPathFinder (find_module) and of Loader (load_module). This commit
extracts both of them and places the code in their own classes.

The MetaPathFinder interface is updated to contain both the deprecated
"find_module" (for Python 2.7 support) and the recommended "find_spec".
Update of the Loader interface is deferred at a subsequent commit.

* Move the lines to be prepended inside "RepoLoader"

Also adjust the naming of a few variables too

* Remove spack.util.imp, since code is only used in spack.repo

* Remove support from loading Python modules Python > 3 but < 3.5

* Remove `Repo._create_namespace`

This function was interacting badly with the MetaPathFinder
and causing issues with "normal" imports. Removing the
function allows to do things like:
```python
import spack.pkg.builtin.mpich
cls = spack.pkg.builtin.mpich.Mpich
```

* Remove code needed to trigger the Singleton evaluation

The finder is coded in a way to trigger the Singleton,
so we don't need external code now that we register it
at module level into `sys.meta_path`.

* Add unit tests
2022-04-07 15:58:20 -07:00
..
bash Fix tab completion erroring with spack unit-test (#29405) 2022-03-09 16:09:57 +01:00
bootstrap/github-actions Bootstrap GnuPG (#24003) 2021-11-02 23:15:24 -07:00
csh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
docker Update copyright year to 2022 2022-01-14 22:50:21 -08:00
docs/docker/module-file-tutorial Update copyright year to 2022 2022-01-14 22:50:21 -08:00
gitlab e4s ci: expand mac mini stack (#29929) 2022-04-07 15:28:33 -07:00
keys Update the Public key of the tutorial (#27370) 2021-11-12 11:46:02 +01:00
logo add artisanal handcrafted SVG Spack logo. (#6165) 2017-11-06 22:42:16 -08:00
qa Use the non-deprecated MetaPathFinder interface (#29745) 2022-04-07 15:58:20 -07:00
templates Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-env.csh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-env.fish Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-env.sh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-tutorial-env.sh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
spack-completion.bash spack info: make sections optional; add build/stand-alone test information (#22097) 2022-03-28 22:15:38 +00:00