summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-02-05 16:33:41 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-02-05 16:33:41 (GMT)
commit47dc7517cd156ad0faf4d9705c6f7439a7e68b5d (patch)
treee175c3133ac87375b9e6ca570722227d07aca20b
parent85a3cefac9e3be6222abf0536d7e243c2da322df (diff)
downloadcpython-47dc7517cd156ad0faf4d9705c6f7439a7e68b5d.zip
cpython-47dc7517cd156ad0faf4d9705c6f7439a7e68b5d.tar.gz
cpython-47dc7517cd156ad0faf4d9705c6f7439a7e68b5d.tar.bz2
Fix get_python_inc() to work when building in a directory separate from
the source. Also, define 'srcdir' on non-posix platforms.
-rw-r--r--Lib/distutils/sysconfig.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index b17743a..de8c5fc 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -72,14 +72,17 @@ def get_python_inc(plat_specific=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
if python_build:
+ # Assume the executable is in the build directory. The
+ # pyconfig.h file should be in the same directory. Since
+ # the build directory may not be the source directory, we
+ # must use "srcdir" from the makefile to find the "Include"
+ # directory.
base = os.path.dirname(os.path.abspath(sys.executable))
if plat_specific:
- inc_dir = base
+ return base
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")
- return inc_dir
+ incdir = os.path.join(get_config_var('srcdir'), 'Include')
+ return os.path.normpath(incdir)
return os.path.join(prefix, "include", "python" + get_python_version())
elif os.name == "nt":
return os.path.join(prefix, "include")