0
0
mirror of https://github.com/python/cpython.git synced 2024-12-01 11:15:56 +01:00

Patch #411055 from MvL: import each extension after building it, and

delete ones that can't be imported due to missing symbols or other
    causes.
This commit is contained in:
Andrew M. Kuchling 2001-05-21 20:48:09 +00:00
parent 185bd6fc76
commit 6268669612

View File

@ -130,6 +130,17 @@ class PyBuildExt(build_ext):
except (CCompilerError, DistutilsError), why:
self.announce('WARNING: building of extension "%s" failed: %s' %
(ext.name, sys.exc_info()[1]))
return
try:
__import__(ext.name)
except ImportError:
self.announce('WARNING: removing "%s" since importing it failed' %
ext.name)
assert not self.inplace
fullname = self.get_ext_fullname(ext.name)
ext_filename = os.path.join(self.build_lib,
self.get_ext_filename(fullname))
os.remove(ext_filename)
def get_platform (self):
# Get value of sys.platform
@ -602,6 +613,9 @@ class PyBuildInstall(install):
self.warn_dir=0
def main():
# turn off warnings when deprecated modules are imported
import warnings
warnings.filterwarnings("ignore",category=DeprecationWarning)
setup(name = 'Python standard library',
version = '%d.%d' % sys.version_info[:2],
cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall},