diff options
| author | Sam James <sam@gentoo.org> | 2025-10-17 20:47:19 +0100 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-10-31 01:13:28 -0400 |
| commit | 373cc823b009c5a0ceb06c462d656ec510a2505b (patch) | |
| tree | bdbcf9f9214e10fa1d64734248402a8b291ebf93 /mesonbuild | |
| parent | 6b4f2c7964115fa5d12f8f2234715a2ee67ea8dd (diff) | |
| download | meson-373cc823b009c5a0ceb06c462d656ec510a2505b.tar.gz | |
compilers: handle older Python behaviour for TemporaryDirectory
In an Ubuntu Bionic container with Python 3.7.5:
```
$ python3 -c 'import tempfile; print(tempfile.mkdtemp(dir=""))'
tmpycdjfo6m
$ python3 -c 'import tempfile; print(tempfile.mkdtemp(dir=None))'
/tmp/tmpy6dlpv0r
```
Pass dir as None to get the behaviour we need - which is how newer Pythons
act, as otherwise we aren't running in the cwd for the compile test
that we expect.
This shows up as a failure in _test_all_naming when _find_library_real is
modified to use links().
Diffstat (limited to 'mesonbuild')
| -rw-r--r-- | mesonbuild/compilers/compilers.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index c50c6229c..34520bbb6 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -827,7 +827,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): if extra_args is None: extra_args = [] - with TemporaryDirectoryWinProof(dir=temp_dir) as tmpdirname: + with TemporaryDirectoryWinProof(dir=temp_dir if temp_dir else None) as tmpdirname: no_ccache = False if isinstance(code, str): srcname = os.path.join(tmpdirname, |
