]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #411055 from MvL: import each extension after building it, and
authorAndrew M. Kuchling <amk@amk.ca>
Mon, 21 May 2001 20:48:09 +0000 (20:48 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Mon, 21 May 2001 20:48:09 +0000 (20:48 +0000)
    delete ones that can't be imported due to missing symbols or other
    causes.

setup.py

index f544ee5a23dc1059b7dd5da550c6580c386d6334..5c5f5dc8fdb9e8980693b5b616e0e88186a150bc 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -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},