diff options
author | Andrew Murray <radarhere@users.noreply.github.com> | 2020-08-10 21:10:46 +1000 |
---|---|---|
committer | Andrew Murray <radarhere@users.noreply.github.com> | 2020-08-10 21:10:46 +1000 |
commit | 33c9d86af4dc1df04cf1b38a0102fe7e121173ec (patch) | |
tree | 28520c99830a9be2692677aae55907e8e92ab33a /setuptools/command/build_ext.py | |
parent | 5e60dc50e540a942aeb558aabe7d92ab7eb13d4b (diff) | |
download | python-setuptools-git-33c9d86af4dc1df04cf1b38a0102fe7e121173ec.tar.gz |
Change load_module to exec_module
Diffstat (limited to 'setuptools/command/build_ext.py')
-rw-r--r-- | setuptools/command/build_ext.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 0eb29adc..89a0e328 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -254,8 +254,8 @@ class build_ext(_build_ext): '\n'.join([ "def __bootstrap__():", " global __bootstrap__, __file__, __loader__", - " import sys, os, pkg_resources" + if_dl(", dl"), - " from importlib.machinery import ExtensionFileLoader", + " import sys, os, pkg_resources, importlib.util" + + if_dl(", dl"), " __file__ = pkg_resources.resource_filename" "(__name__,%r)" % os.path.basename(ext._file_name), @@ -267,8 +267,10 @@ class build_ext(_build_ext): " try:", " os.chdir(os.path.dirname(__file__))", if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"), - " ExtensionFileLoader(__name__,", - " __file__).load_module()", + " spec = importlib.util.spec_from_file_location(", + " __name__, __file__)", + " mod = importlib.util.module_from_spec(spec)", + " spec.loader.exec_module(mod)", " finally:", if_dl(" sys.setdlopenflags(old_flags)"), " os.chdir(old_dir)", |