summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-02-05 16:14:39 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-02-05 16:14:39 (GMT)
commit444df457391d6308b061df1b9859860cb13085ce (patch)
tree304f7f6b830cf9efdeb98adef0aacf11825a21e2 /Lib/distutils
parentecd2afa4523fa11da4e354b126f7b49add0c6af2 (diff)
downloadcpython-444df457391d6308b061df1b9859860cb13085ce.zip
cpython-444df457391d6308b061df1b9859860cb13085ce.tar.gz
cpython-444df457391d6308b061df1b9859860cb13085ce.tar.bz2
Fix get_python_inc() to work when building in a directory separate from
the source. Also, define 'srcdir' on non-posix platforms.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/sysconfig.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 9993fba..ec2f8a9 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -73,14 +73,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")
@@ -521,6 +524,9 @@ def get_config_vars(*args):
_config_vars['prefix'] = PREFIX
_config_vars['exec_prefix'] = EXEC_PREFIX
+ if 'srcdir' not in _config_vars:
+ _config_vars['srcdir'] = project_base
+
if sys.platform == 'darwin':
kernel_version = os.uname()[2] # Kernel version (8.4.3)
major_version = int(kernel_version.split('.')[0])