From 3380bad83211ab6e36b5ae357ebc81581386cc00 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Fri, 4 Mar 2022 21:04:04 -0400 Subject: [PATCH] Avoid symlinking the contents of /usr into PyPy3 virtualenvs PyPy >= 3.8 supports a standard prefix installation, where older versions always used a portable/developent style installation. If this is a standard prefix installation, skip the logic that symlinks libraries in a portable PyPy distribution. Fixes: #2309 --- docs/changelog/2310.bugfix.rst | 1 + src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 docs/changelog/2310.bugfix.rst diff --git a/docs/changelog/2310.bugfix.rst b/docs/changelog/2310.bugfix.rst new file mode 100644 index 000000000..b7226d619 --- /dev/null +++ b/docs/changelog/2310.bugfix.rst @@ -0,0 +1 @@ +Avoid symlinking the contents of ``/usr`` into PyPy3.8+ virtualenvs - by :user:`stefanor`. diff --git a/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py b/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py index f1726ec96..cc72c1459 100644 --- a/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py +++ b/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py @@ -42,6 +42,11 @@ def to_lib(self, src): def sources(cls, interpreter): for src in super(PyPy3Posix, cls).sources(interpreter): yield src + # PyPy >= 3.8 supports a standard prefix installation, where older + # versions always used a portable/developent style installation. + # If this is a standard prefix installation, skip the below: + if interpreter.system_prefix == "/usr": + return # Also copy/symlink anything under prefix/lib, which, for "portable" # PyPy builds, includes the tk,tcl runtime and a number of shared # objects. In distro-specific builds or on conda this should be empty