mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Make test_build_ext.py use sysconfig "srcdir" to find the source for
xxmodule.c. Have sysconfig make the srcdir path absolute if that seems necessary (running non-installed Python outside the build directory).
This commit is contained in:
parent
0a7b2c7bc3
commit
d8f63bbce5
2 changed files with 23 additions and 5 deletions
|
@ -504,6 +504,20 @@ def get_config_vars(*args):
|
|||
_config_vars['prefix'] = PREFIX
|
||||
_config_vars['exec_prefix'] = EXEC_PREFIX
|
||||
|
||||
# Convert srcdir into an absolute path if it appears necessary.
|
||||
# Normally it is relative to the build directory. However, during
|
||||
# testing, for example, we might be running a non-installed python
|
||||
# from a different directory.
|
||||
if python_build and os.name == "posix":
|
||||
base = os.path.dirname(os.path.abspath(sys.executable))
|
||||
if (not os.path.isabs(_config_vars['srcdir']) and
|
||||
base != os.getcwd()):
|
||||
# srcdir is relative and we are not in the same directory
|
||||
# as the executable. Assume executable is in the build
|
||||
# directory and make srcdir absolute.
|
||||
srcdir = os.path.join(base, _config_vars['srcdir'])
|
||||
_config_vars['srcdir'] = os.path.normpath(srcdir)
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
kernel_version = os.uname()[2] # Kernel version (8.4.3)
|
||||
major_version = int(kernel_version.split('.')[0])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue