]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix for
authorMichael W. Hudson <mwh@python.net>
Wed, 23 Jan 2002 15:07:46 +0000 (15:07 +0000)
committerMichael W. Hudson <mwh@python.net>
Wed, 23 Jan 2002 15:07:46 +0000 (15:07 +0000)
[ #433775 ] module build dir first in test import

though not in the way the summary would suggest; use imp.load_dynamic()
in setup.py to ensure we're testing the dynamic object we think we are.

setup.py

index ae08f4a6136f8ee90a2c11299f150eab4e3c0406..6fc9360e97cb04dd2d5f43741a19f5b739c8015d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 
 __version__ = "$Revision$"
 
-import sys, os, getopt
+import sys, os, getopt, imp
 from distutils import sysconfig
 from distutils import text_file
 from distutils.errors import *
@@ -168,8 +168,11 @@ class PyBuildExt(build_ext):
                 'WARNING: skipping import check for Carbon-based "%s"' %
                 ext.name)
             return
+        ext_filename = os.path.join(
+            self.build_lib,
+            self.get_ext_filename(self.get_ext_fullname(ext.name)))
         try:
-            __import__(ext.name)
+            imp.load_dynamic(ext.name, ext_filename)
         except ImportError:
             self.announce('WARNING: removing "%s" since importing it failed' %
                           ext.name)