mirror of
https://github.com/python/cpython.git
synced 2025-08-28 04:35:02 +00:00
Issue #19713: Move away from using find_module/load_module.
This commit is contained in:
parent
d749c7ae68
commit
335e14dd1a
3 changed files with 12 additions and 5 deletions
6
setup.py
6
setup.py
|
@ -3,6 +3,8 @@
|
|||
|
||||
import sys, os, importlib.machinery, re, optparse
|
||||
from glob import glob
|
||||
import importlib._bootstrap
|
||||
import importlib.util
|
||||
import sysconfig
|
||||
|
||||
from distutils import log
|
||||
|
@ -327,8 +329,10 @@ class PyBuildExt(build_ext):
|
|||
return
|
||||
|
||||
loader = importlib.machinery.ExtensionFileLoader(ext.name, ext_filename)
|
||||
spec = importlib.util.spec_from_file_location(ext.name, ext_filename,
|
||||
loader=loader)
|
||||
try:
|
||||
loader.load_module()
|
||||
importlib._bootstrap._SpecMethods(spec).load()
|
||||
except ImportError as why:
|
||||
self.failed.append(ext.name)
|
||||
self.announce('*** WARNING: renaming "%s" since importing it'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue