Issue # 17177: Stop using imp in setup.py

This commit is contained in:
Brett Cannon 2013-06-15 17:52:59 -04:00
parent e7e1deef17
commit ca5ff3a069
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# Autodetecting setup.py script for building the Python extensions
#
import sys, os, imp, re, optparse
import sys, os, importlib.machinery, re, optparse
from glob import glob
import sysconfig
@ -325,8 +325,9 @@ class PyBuildExt(build_ext):
if cross_compiling:
return
loader = importlib.machinery.ExtensionFileLoader(ext.name, ext_filename)
try:
imp.load_dynamic(ext.name, ext_filename)
loader.load_module()
except ImportError as why:
self.failed.append(ext.name)
self.announce('*** WARNING: renaming "%s" since importing it'