From 0a82048ee585efbd85656047843e29792cf84a3a Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Fri, 24 Jun 2022 23:23:59 +0100 Subject: Test symlinks in the target directory Improve chances that symlinks are tested directly on the relevant file system (some machines might have multiple disks with different link support). --- setuptools/command/editable_wheel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index bd580acb..8a0fb8bc 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -339,7 +339,8 @@ class _LinkTree(_StaticPth): self._file(src_file, dest, link=link) def _create_links(self, outputs, output_mapping): - link_type = "sym" if _can_symlink_files() else "hard" + self.auxiliary_dir.mkdir(parents=True, exist_ok=True) + link_type = "sym" if _can_symlink_files(self.auxiliary_dir) else "hard" mappings = { self._normalize_output(k): v for k, v in output_mapping.items() @@ -403,8 +404,8 @@ class _TopLevelFinder: ... -def _can_symlink_files() -> bool: - with TemporaryDirectory() as tmp: +def _can_symlink_files(base_dir: Path) -> bool: + with TemporaryDirectory(dir=str(base_dir.resolve())) as tmp: path1, path2 = Path(tmp, "file1.txt"), Path(tmp, "file2.txt") path1.write_text("file1", encoding="utf-8") with suppress(AttributeError, NotImplementedError, OSError): -- cgit v1.2.1