diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-11-23 14:14:02 +0000 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-11-23 14:14:02 +0000 |
| commit | ad262229d2fb5ff142a82d155e4a072732f9955b (patch) | |
| tree | 35b927b250bbcb220e176ac4c8eade3c7015cb87 /setuptools | |
| parent | 8f2cf582a0cdc3ee2ec9af45d2260714b5026823 (diff) | |
| parent | 9a020ce8471624d20b426e2c5e2241c81a899918 (diff) | |
| download | python-setuptools-git-ad262229d2fb5ff142a82d155e4a072732f9955b.tar.gz | |
Fix build directories interference with auto-discovery (#3704)
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/build_meta.py | 3 | ||||
| -rw-r--r-- | setuptools/tests/test_config_discovery.py | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index e8f1c72d..1fb4c3b1 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -385,7 +385,8 @@ class _BuildMetaBackend(_ConfigSettingsTranslator): # Build in a temporary directory, then copy to the target. os.makedirs(result_directory, exist_ok=True) - with tempfile.TemporaryDirectory(dir=result_directory) as tmp_dist_dir: + temp_opts = {"prefix": ".tmp-", "dir": result_directory} + with tempfile.TemporaryDirectory(**temp_opts) as tmp_dist_dir: sys.argv = [ *sys.argv[:1], *self._global_args(config_settings), diff --git a/setuptools/tests/test_config_discovery.py b/setuptools/tests/test_config_discovery.py index 85b64b31..f65b00b6 100644 --- a/setuptools/tests/test_config_discovery.py +++ b/setuptools/tests/test_config_discovery.py @@ -248,6 +248,19 @@ class TestDiscoverPackagesAndPyModules: with pytest.raises(PackageDiscoveryError, match="multiple (packages|modules)"): _get_dist(tmp_path, {}) + def test_py_modules_when_wheel_dir_is_cwd(self, tmp_path): + """Regression for issue 3692""" + from setuptools import build_meta + + pyproject = '[project]\nname = "test"\nversion = "1"' + (tmp_path / "pyproject.toml").write_text(DALS(pyproject), encoding="utf-8") + (tmp_path / "foo.py").touch() + with jaraco.path.DirectoryStack().context(tmp_path): + build_meta.build_wheel(".") + # Ensure py_modules are found + wheel_files = get_wheel_members(next(tmp_path.glob("*.whl"))) + assert "foo.py" in wheel_files + class TestNoConfig: DEFAULT_VERSION = "0.0.0" # Default version given by setuptools |
