aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/_imp.py
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2019-10-28 10:28:55 +0300
committerBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2019-10-28 10:46:48 +0300
commit65fe7abeaba9e82b8f3755054759fed21c0c489b (patch)
tree56d052ccb63e9cf773dada7a2bacd54e08fbe8b5 /setuptools/_imp.py
parent16051d6b2d3641dc8951e90f7f04bcd04b8954d3 (diff)
downloadexternal_python_setuptools-65fe7abeaba9e82b8f3755054759fed21c0c489b.tar.gz
external_python_setuptools-65fe7abeaba9e82b8f3755054759fed21c0c489b.tar.bz2
external_python_setuptools-65fe7abeaba9e82b8f3755054759fed21c0c489b.zip
py34 compat
Diffstat (limited to 'setuptools/_imp.py')
-rw-r--r--setuptools/_imp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/setuptools/_imp.py b/setuptools/_imp.py
index cee91551..09073d44 100644
--- a/setuptools/_imp.py
+++ b/setuptools/_imp.py
@@ -4,6 +4,7 @@ from the deprecated imp module.
"""
import os
+import sys
import importlib.util
import importlib.machinery
@@ -70,7 +71,12 @@ def _resolve(spec):
else spec
)
+def _module_from_spec(spec):
+ if sys.version_info >= (3, 5):
+ return importlib.util.module_from_spec(spec)
+ else:
+ return spec.loader.load_module(spec.name)
def get_module(module, paths, info):
spec = importlib.util.find_spec(module, paths)
- return importlib.util.module_from_spec(spec)
+ return _module_from_spec(spec)