diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2022-04-08 00:58:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 15:58:20 -0700 |
commit | ff04d1bfc186a0563728707a3dc08ebdfc1a6f59 (patch) | |
tree | 564b25da0780d2f3f8fee4ac0863ba7b6c4bcaef /lib/spack/docs/conf.py | |
parent | 48b222c36bc3d8091100c7367b70294ea5dce796 (diff) | |
download | spack-ff04d1bfc186a0563728707a3dc08ebdfc1a6f59.tar.gz spack-ff04d1bfc186a0563728707a3dc08ebdfc1a6f59.tar.bz2 spack-ff04d1bfc186a0563728707a3dc08ebdfc1a6f59.tar.xz spack-ff04d1bfc186a0563728707a3dc08ebdfc1a6f59.zip |
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
Diffstat (limited to 'lib/spack/docs/conf.py')
-rw-r--r-- | lib/spack/docs/conf.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 5beb0980ba..5455aa0f28 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -180,6 +180,7 @@ nitpick_ignore = [ ('py:class', '_frozen_importlib_external.SourceFileLoader'), # Spack classes that are private and we don't want to expose ('py:class', 'spack.provider_index._IndexBase'), + ('py:class', 'spack.repo._PrependFileLoader'), ] # The reST default role (used for this markup: `text`) to use for all documents. |