Commit 092c2c91 authored by Neil Schemenauer's avatar Neil Schemenauer

Fix get_python_inc() to work when building in a directory separate from

the source.  Also, define 'srcdir' on non-posix platforms.
parent 7126baf0
...@@ -72,14 +72,17 @@ def get_python_inc(plat_specific=0, prefix=None): ...@@ -72,14 +72,17 @@ def get_python_inc(plat_specific=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix": if os.name == "posix":
if python_build: 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)) base = os.path.dirname(os.path.abspath(sys.executable))
if plat_specific: if plat_specific:
inc_dir = base return base
else: else:
inc_dir = os.path.join(base, "Include") incdir = os.path.join(get_config_var('srcdir'), 'Include')
if not os.path.exists(inc_dir): return os.path.normpath(incdir)
inc_dir = os.path.join(os.path.dirname(base), "Include")
return inc_dir
return os.path.join(prefix, "include", "python" + get_python_version()) return os.path.join(prefix, "include", "python" + get_python_version())
elif os.name == "nt": elif os.name == "nt":
return os.path.join(prefix, "include") return os.path.join(prefix, "include")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment