diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2012-07-27 12:06:55 +0100 |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2012-07-27 12:06:55 +0100 |
commit | 46874ad367c2f3fdd47b2c8cb4b405bbcb2ed14a (patch) | |
tree | 7a082ee1141091afb3a20761d045ab0cf6cad5f4 /Lib/distutils/sysconfig.py | |
parent | a61b45980b4a6187e043abfb10c727b82e619ee2 (diff) | |
download | cpython-git-46874ad367c2f3fdd47b2c8cb4b405bbcb2ed14a.tar.gz |
Issue #15364: Fix sysconfig.get_config_var('srcdir') to be an absolute path.
Diffstat (limited to 'Lib/distutils/sysconfig.py')
-rw-r--r-- | Lib/distutils/sysconfig.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 910e1047ab..317640ca89 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -533,6 +533,23 @@ def get_config_vars(*args): _config_vars['prefix'] = PREFIX _config_vars['exec_prefix'] = EXEC_PREFIX + # Always convert srcdir to an absolute path + srcdir = _config_vars.get('srcdir', project_base) + if os.name == 'posix': + if python_build: + # If srcdir is a relative path (typically '.' or '..') + # then it should be interpreted relative to the directory + # containing Makefile. + base = os.path.dirname(get_makefile_filename()) + srcdir = os.path.join(base, srcdir) + else: + # srcdir is not meaningful since the installation is + # spread about the filesystem. We choose the + # directory containing the Makefile since we know it + # exists. + srcdir = os.path.dirname(get_makefile_filename()) + _config_vars['srcdir'] = os.path.abspath(os.path.normpath(srcdir)) + # 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 |