diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-01-23 18:13:32 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-01-23 18:13:32 -0500 |
| commit | e2f1814e0d3d8963cf3a1eb4dff6d400b58b4a52 (patch) | |
| tree | ebbf48671f53d2e7688ef548035ffd0e1e56bb82 | |
| parent | 7372d185e72fda6c8ad3eea6c5faac61eae602c5 (diff) | |
| download | external_python_setuptools-e2f1814e0d3d8963cf3a1eb4dff6d400b58b4a52.tar.gz external_python_setuptools-e2f1814e0d3d8963cf3a1eb4dff6d400b58b4a52.tar.bz2 external_python_setuptools-e2f1814e0d3d8963cf3a1eb4dff6d400b58b4a52.zip | |
Invoke import on importlib.machinery directly. Access an attribute to force import in delayed-import environments. Fixes #487.
| -rw-r--r-- | CHANGES.txt | 7 | ||||
| -rw-r--r-- | pkg_resources/__init__.py | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 06c6aad1..a6f58b2d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES ======= +19.4.1 +------ + +* Issue #487: Use direct invocation of ``importlib.machinery`` + in ``pkg_resources`` to avoid missing detection on relevant + platforms. + 19.4 ---- diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 50b86cdb..3ecf4c64 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -60,10 +60,11 @@ except ImportError: from os import open as os_open from os.path import isdir, split -# Avoid try/except due to potential problems with delayed import mechanisms. -if sys.version_info >= (3, 3) and sys.implementation.name == "cpython": +try: import importlib.machinery as importlib_machinery -else: + # access attribute to force import under delayed import mechanisms. + importlib_machinery.__name__ +except ImportError: importlib_machinery = None try: |
