--- ./Lib/distutils/sysconfig.py.DIST 2008-08-06 23:37:01.000000000 +0300 +++ ./Lib/distutils/sysconfig.py 2008-09-29 00:47:45.000000000 +0300 @@ -25,6 +25,8 @@ # Path to the base directory of the project. On Windows the binary may # live in project/PCBuild9. If we're dealing with an x64 Windows build, # it'll live in project/PCbuild/amd64. +# NOTE: project_base is de facto top-build directory and may differ +# from top-source directory (at least on posix system). project_base = os.path.dirname(os.path.abspath(sys.executable)) if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) @@ -73,13 +75,10 @@ prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": if python_build: - base = os.path.dirname(os.path.abspath(sys.executable)) if plat_specific: - inc_dir = base + inc_dir = project_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") + inc_dir = os.path.join(get_config_var('srcdir'), "Include") return inc_dir return os.path.join(prefix, "include", "python" + get_python_version()) elif os.name == "nt": --- ./Lib/distutils/tests/test_build_ext.py.DIST 2008-09-24 21:47:13.000000000 +0300 +++ ./Lib/distutils/tests/test_build_ext.py 2008-09-28 01:43:35.000000000 +0300 @@ -19,7 +19,11 @@ self.sys_path = sys.path[:] sys.path.append(self.tmp_dir) - xx_c = os.path.join(sysconfig.project_base, 'Modules', 'xxmodule.c') + if os.name == "posix": + srcdir = sysconfig.get_config_var('srcdir') + else: + srcdir = sysconfig.project_base + xx_c = os.path.join(srcdir, 'Modules', 'xxmodule.c') shutil.copy(xx_c, self.tmp_dir) def test_build_ext(self):