Skip to content

Commit f7e0784

Browse files
authored
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).
1 parent 8c3f05e commit f7e0784

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/libregrtest/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
# to keep the test files in a subfolder. This eases the cleanup of leftover
2929
# files using the "make distclean" command.
3030
if sysconfig.is_python_build():
31-
TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build')
31+
TEMPDIR = sysconfig.get_config_var('abs_builddir')
32+
if TEMPDIR is None:
33+
# bpo-30284: On Windows, only srcdir is available. Using abs_builddir
34+
# mostly matters on UNIX when building Python out of the source tree,
35+
# especially when the source tree is read only.
36+
TEMPDIR = sysconfig.get_config_var('srcdir')
37+
TEMPDIR = os.path.join(TEMPDIR, 'build')
3238
else:
3339
TEMPDIR = tempfile.gettempdir()
3440
TEMPDIR = os.path.abspath(TEMPDIR)

0 commit comments

Comments
 (0)