From 54576cd794530768a67bddba2f7450b614611e92 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 2 May 2023 14:35:59 -0700 Subject: [PATCH] pep517 backend - Copy symlinks when copying source (#80690) --- changelogs/fragments/pep517-backend-traceback-fix.yml | 3 +++ packaging/pep517_backend/_backend.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/pep517-backend-traceback-fix.yml diff --git a/changelogs/fragments/pep517-backend-traceback-fix.yml b/changelogs/fragments/pep517-backend-traceback-fix.yml new file mode 100644 index 00000000000..cf779f9b465 --- /dev/null +++ b/changelogs/fragments/pep517-backend-traceback-fix.yml @@ -0,0 +1,3 @@ +bugfixes: + - pep517 build backend - Copy symlinks when copying the source tree. + This avoids tracebacks in various scenarios, such as when a venv is present in the source tree. diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py index 633de63bffe..f7c9226655b 100644 --- a/packaging/pep517_backend/_backend.py +++ b/packaging/pep517_backend/_backend.py @@ -118,7 +118,7 @@ def build_sdist( # noqa: WPS210, WPS430 original_src_dir = Path.cwd().resolve() with _run_in_temporary_directory() as tmp_dir: tmp_src_dir = Path(tmp_dir) / 'src' - copytree(original_src_dir, tmp_src_dir) + copytree(original_src_dir, tmp_src_dir, symlinks=True) os.chdir(tmp_src_dir) if build_manpages_requested: