diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-06-14 22:44:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 22:44:05 (GMT) |
commit | f7e07840d725f2ebb469129cb5e6574ce61725ef (patch) | |
tree | 40d31fd0d6cf6a00999ed4787532d1763f27eef6 /Lib/test/libregrtest | |
parent | 8c3f05e9f0f0b30a3d4a2433e92471794d8258af (diff) | |
download | cpython-f7e07840d725f2ebb469129cb5e6574ce61725ef.zip cpython-f7e07840d725f2ebb469129cb5e6574ce61725ef.tar.gz cpython-f7e07840d725f2ebb469129cb5e6574ce61725ef.tar.bz2 |
bpo-30284: Fix regrtest for out of tree build (#1481)
Use a build/ directory in the build directory, not in the source
directory, since the source directory may be read-only and must not
be modified.
Fallback on the source directory if the build directory is not
available (missing "abs_builddir" sysconfig variable).
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r-- | Lib/test/libregrtest/main.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index e068b92..7b11fe9 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -28,7 +28,13 @@ except ImportError: # to keep the test files in a subfolder. This eases the cleanup of leftover # files using the "make distclean" command. if sysconfig.is_python_build(): - TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build') + TEMPDIR = sysconfig.get_config_var('abs_builddir') + if TEMPDIR is None: + # bpo-30284: On Windows, only srcdir is available. Using abs_builddir + # mostly matters on UNIX when building Python out of the source tree, + # especially when the source tree is read only. + TEMPDIR = sysconfig.get_config_var('srcdir') + TEMPDIR = os.path.join(TEMPDIR, 'build') else: TEMPDIR = tempfile.gettempdir() TEMPDIR = os.path.abspath(TEMPDIR) |