Commit e2f1814e authored by Jason R. Coombs's avatar Jason R. Coombs

Invoke import on importlib.machinery directly. Access an attribute to force...

Invoke import on importlib.machinery directly. Access an attribute to force import in delayed-import environments. Fixes #487.
parent 7372d185
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
CHANGES CHANGES
======= =======
19.4.1
------
* Issue #487: Use direct invocation of ``importlib.machinery``
in ``pkg_resources`` to avoid missing detection on relevant
platforms.
19.4 19.4
---- ----
......
...@@ -60,10 +60,11 @@ except ImportError: ...@@ -60,10 +60,11 @@ except ImportError:
from os import open as os_open from os import open as os_open
from os.path import isdir, split from os.path import isdir, split
# Avoid try/except due to potential problems with delayed import mechanisms. try:
if sys.version_info >= (3, 3) and sys.implementation.name == "cpython":
import importlib.machinery as importlib_machinery import importlib.machinery as importlib_machinery
else: # access attribute to force import under delayed import mechanisms.
importlib_machinery.__name__
except ImportError:
importlib_machinery = None importlib_machinery = None
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment