]> granicus.if.org Git - python/commitdiff
Fixed #8577. distutils.sysconfig.get_python_inc() now differenciates buildir and...
authorTarek Ziadé <ziade.tarek@gmail.com>
Fri, 30 Apr 2010 12:15:12 +0000 (12:15 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Fri, 30 Apr 2010 12:15:12 +0000 (12:15 +0000)
Lib/distutils/sysconfig.py
Misc/NEWS

index 54ccec495318441261b1a4c6bc5c9b357e1956a3..bb53315bcad7b46f0df33f6581e52c82058ba93b 100644 (file)
@@ -71,15 +71,19 @@ def get_python_inc(plat_specific=0, prefix=None):
     """
     if prefix is None:
         prefix = plat_specific and EXEC_PREFIX or PREFIX
+
     if os.name == "posix":
         if python_build:
-            base = os.path.dirname(os.path.abspath(sys.executable))
+            buildir = os.path.dirname(sys.executable)
             if plat_specific:
-                inc_dir = base
+                # python.h is located in the buildir
+                inc_dir = buildir
             else:
-                inc_dir = os.path.join(base, "Include")
-                if not os.path.exists(inc_dir):
-                    inc_dir = os.path.join(os.path.dirname(base), "Include")
+                # the source dir is relative to the buildir
+                srcdir = os.path.abspath(os.path.join(buildir,
+                                         get_config_var('srcdir')))
+                # Include is located in the srcdir
+                inc_dir = os.path.join(srcdir, "Include")
             return inc_dir
         return os.path.join(prefix, "include", "python" + get_python_version())
     elif os.name == "nt":
index a43825c99fa8b795707af4b96c2f605ec7bfbf16..b42665a04249cad600f40a7c6f9184cf2dafed7b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -31,6 +31,10 @@ Core and Builtins
 Library
 -------
 
+- Issue #8577: distutils.sysconfig.get_python_inc() now makes a difference 
+  between the build dir and the source dir when looking for "python.h" or
+  "Include".
+
 - Issue #8464: tarfile no longer creates files with execute permissions set
   when mode="w|" is used.