summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-10-23 13:13:44 +0300
committerGitHub <noreply@github.com>2021-10-23 11:13:44 +0100
commit4188ac6e72d3b731595c83d46d1c0eb76fe4f6eb (patch)
treee8fdb513cc9d6dc968c8d3b82debf73bca85a0e9
parent35ec4416d2012cfcb7a5e638813f6d52e852f29f (diff)
downloadvirtualenv-4188ac6e72d3b731595c83d46d1c0eb76fe4f6eb.tar.gz
Support PyPy 3.8 (#2206)
Co-authored-by: Michał Górny <mgorny@gentoo.org> Co-authored-by: Bernát Gábor <bgabor8@bloomberg.net>
-rw-r--r--.github/workflows/check.yml6
-rw-r--r--docs/changelog/2182.bugfix.txt2
-rw-r--r--src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py12
3 files changed, 17 insertions, 3 deletions
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index f2b1f23..f7b8cbb 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -34,9 +34,11 @@ jobs:
- 3.7
- 3.6
- 3.5
- - pypy3
+ - pypy-3.6
+ - pypy-3.7-v7.3.6rc3
+ - pypy-3.8-v7.3.6rc3
- 2.7
- - pypy2
+ - pypy-2.7
include:
- { os: macos-latest, py: brew@py3 }
steps:
diff --git a/docs/changelog/2182.bugfix.txt b/docs/changelog/2182.bugfix.txt
new file mode 100644
index 0000000..0f26a20
--- /dev/null
+++ b/docs/changelog/2182.bugfix.txt
@@ -0,0 +1,2 @@
+Fixed path collision that could lead to a PermissionError or writing to system
+directories when using PyPy3.8 - by :user:`mgorny`.
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 2e7e10c..25d8e16 100644
--- a/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py
+++ b/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py
@@ -28,7 +28,7 @@ class PyPy3Posix(PyPy3, PosixSupports):
@property
def stdlib(self):
"""PyPy3 respects sysconfig only for the host python, virtual envs is instead lib/pythonx.y/site-packages"""
- return self.dest / "lib" / "python{}".format(self.interpreter.version_release_str) / "site-packages"
+ return self.dest / "lib" / "pypy{}".format(self.interpreter.version_release_str) / "site-packages"
@classmethod
def _shared_libs(cls):
@@ -41,9 +41,19 @@ class PyPy3Posix(PyPy3, PosixSupports):
def sources(cls, interpreter):
for src in super(PyPy3Posix, cls).sources(interpreter):
yield src
+ # 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
+ # (on PyPy3.8+ it will, like on CPython, hold the stdlib).
host_lib = Path(interpreter.system_prefix) / "lib"
+ stdlib = Path(interpreter.system_stdlib)
if host_lib.exists() and host_lib.is_dir():
for path in host_lib.iterdir():
+ if stdlib == path:
+ # For PyPy3.8+ the stdlib lives in lib/pypy3.8
+ # We need to avoid creating a symlink to it since that
+ # will defeat the purpose of a virtualenv
+ continue
yield PathRefToDest(path, dest=cls.to_lib)