summaryrefslogtreecommitdiff
path: root/setuptools/command/build_ext.py
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2020-06-21 16:39:53 -0600
committerAlex Henrie <alexhenrie24@gmail.com>2020-06-21 16:39:53 -0600
commit4516d87036f971a4c98900301b6354c0aae73dc8 (patch)
tree77c560616611e46f880294751b1f8d5dd2a9fa84 /setuptools/command/build_ext.py
parent145a78cdc1afb4ce0c0208ae86a00708eb79d27b (diff)
downloadpython-setuptools-git-4516d87036f971a4c98900301b6354c0aae73dc8.tar.gz
Use importlib instead of imp in __bootstrap__ functions
Diffstat (limited to 'setuptools/command/build_ext.py')
-rw-r--r--setuptools/command/build_ext.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 03b6f346..327fa063 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -254,7 +254,8 @@ class build_ext(_build_ext):
'\n'.join([
"def __bootstrap__():",
" global __bootstrap__, __file__, __loader__",
- " import sys, os, pkg_resources, imp" + if_dl(", dl"),
+ " import sys, os, pkg_resources" + if_dl(", dl"),
+ " from importlib.machinery import ExtensionFileLoader",
" __file__ = pkg_resources.resource_filename"
"(__name__,%r)"
% os.path.basename(ext._file_name),
@@ -266,7 +267,8 @@ class build_ext(_build_ext):
" try:",
" os.chdir(os.path.dirname(__file__))",
if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"),
- " imp.load_dynamic(__name__,__file__)",
+ " ExtensionFileLoader(__name__,",
+ " __file__).exec_module()",
" finally:",
if_dl(" sys.setdlopenflags(old_flags)"),
" os.chdir(old_dir)",