diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-02-06 21:42:05 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-02-06 21:42:05 (GMT) |
commit | d8f63bbce50c702086cc93ea2131c268752d45b3 (patch) | |
tree | e0d344fc0524baf840c09e596148862bc08c45c2 /Lib/distutils/sysconfig.py | |
parent | 0a7b2c7bc393aee46081fe566ebd3edf0e8d5073 (diff) | |
download | cpython-d8f63bbce50c702086cc93ea2131c268752d45b3.zip cpython-d8f63bbce50c702086cc93ea2131c268752d45b3.tar.gz cpython-d8f63bbce50c702086cc93ea2131c268752d45b3.tar.bz2 |
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).
Diffstat (limited to 'Lib/distutils/sysconfig.py')
-rw-r--r-- | Lib/distutils/sysconfig.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 386ae89..a3ef3f6 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -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]) |