|
24 | 24 | # Path to the base directory of the project. On Windows the binary may
|
25 | 25 | # live in project/PCBuild9. If we're dealing with an x64 Windows build,
|
26 | 26 | # it'll live in project/PCbuild/amd64.
|
27 |
| -project_base = os.path.dirname(os.path.abspath(sys.executable)) |
| 27 | +# set for cross builds |
| 28 | +if "_PYTHON_PROJECT_BASE" in os.environ: |
| 29 | + project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"]) |
| 30 | +else: |
| 31 | + project_base = os.path.dirname(os.path.abspath(sys.executable)) |
28 | 32 | if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
|
29 | 33 | project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
|
30 | 34 | # PC/VS7.1
|
@@ -98,7 +102,7 @@ def get_python_inc(plat_specific=0, prefix=None):
|
98 | 102 | # the build directory may not be the source directory, we
|
99 | 103 | # must use "srcdir" from the makefile to find the "Include"
|
100 | 104 | # directory.
|
101 |
| - base = _sys_home or os.path.dirname(os.path.abspath(sys.executable)) |
| 105 | + base = _sys_home or project_base |
102 | 106 | if plat_specific:
|
103 | 107 | return base
|
104 | 108 | if _sys_home:
|
@@ -251,8 +255,7 @@ def get_config_h_filename():
|
251 | 255 | def get_makefile_filename():
|
252 | 256 | """Return full pathname of installed Makefile from the Python build."""
|
253 | 257 | if python_build:
|
254 |
| - return os.path.join(_sys_home or os.path.dirname(sys.executable), |
255 |
| - "Makefile") |
| 258 | + return os.path.join(_sys_home or project_base, "Makefile") |
256 | 259 | lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
|
257 | 260 | config_file = 'config-{}{}'.format(get_python_version(), build_flags)
|
258 | 261 | return os.path.join(lib_dir, config_file, 'Makefile')
|
@@ -555,7 +558,7 @@ def get_config_vars(*args):
|
555 | 558 | # testing, for example, we might be running a non-installed python
|
556 | 559 | # from a different directory.
|
557 | 560 | if python_build and os.name == "posix":
|
558 |
| - base = os.path.dirname(os.path.abspath(sys.executable)) |
| 561 | + base = project_base |
559 | 562 | if (not os.path.isabs(_config_vars['srcdir']) and
|
560 | 563 | base != os.getcwd()):
|
561 | 564 | # srcdir is relative and we are not in the same directory
|
|
0 commit comments