--- /Users/kesara/ResearchLab/cpython/Lib/distutils/sysconfig.py 2016-09-12 10:14:59.000000000 +1200 +++ Lib/distutils/sysconfig.py 2016-09-13 15:59:17.000000000 +1200 @@ -72,6 +72,18 @@ """ return '%d.%d' % sys.version_info[:2] +def _get_build_dir(name, plat_specific): + # 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: + return base + else: + thedir = os.path.join(get_config_var('srcdir'), name) + return os.path.normpath(thedir) def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. @@ -88,19 +100,7 @@ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_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 = _sys_home or project_base - if plat_specific: - return base - if _sys_home: - incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR')) - else: - incdir = os.path.join(get_config_var('srcdir'), 'Include') - return os.path.normpath(incdir) + return _get_build_dir('Include', plat_specific) python_dir = 'python' + get_python_version() + build_flags return os.path.join(prefix, "include", python_dir) elif os.name == "nt": @@ -132,6 +132,8 @@ prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": + if python_build: + return _get_build_dir('Lib', plat_specific) libpython = os.path.join(prefix, "lib", "python" + get_python_version()) if standard_lib: