Commit f7e07840 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

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).
parent 8c3f05e9
...@@ -28,7 +28,13 @@ except ImportError: ...@@ -28,7 +28,13 @@ except ImportError:
# to keep the test files in a subfolder. This eases the cleanup of leftover # to keep the test files in a subfolder. This eases the cleanup of leftover
# files using the "make distclean" command. # files using the "make distclean" command.
if sysconfig.is_python_build(): 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: else:
TEMPDIR = tempfile.gettempdir() TEMPDIR = tempfile.gettempdir()
TEMPDIR = os.path.abspath(TEMPDIR) TEMPDIR = os.path.abspath(TEMPDIR)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment