From 5144e6a47422a5135e2a8ab0811c8875297ef254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 1 Mar 2021 09:18:35 +0000 Subject: [PATCH] Fix Pypy3 Windows stdlib path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- .pre-commit-config.yaml | 2 +- docs/changelog/2071.bugfix.rst | 1 + .../via_global_ref/builtin/pypy/pypy3.py | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 docs/changelog/2071.bugfix.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d9eba0b31..6e2b3c8f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - id: blacken-docs additional_dependencies: [black==20.8b1] - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.7.1 + rev: v1.8.0 hooks: - id: rst-backticks - repo: https://github.com/tox-dev/tox-ini-fmt diff --git a/docs/changelog/2071.bugfix.rst b/docs/changelog/2071.bugfix.rst new file mode 100644 index 000000000..c8c87b35f --- /dev/null +++ b/docs/changelog/2071.bugfix.rst @@ -0,0 +1 @@ +Fix PyPy3 stdlib on Windows is incorrect - by :user:`gaborbernat`. 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 958870678..65b2e099c 100644 --- a/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py +++ b/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py @@ -17,14 +17,6 @@ class PyPy3(PyPy, Python3Supports): def exe_stem(cls): return "pypy3" - @property - def stdlib(self): - """ - PyPy3 seems to respect sysconfig only for the host python... - virtual environments purelib is instead lib/pythonx.y - """ - return self.dest / "lib" / "python{}".format(self.interpreter.version_release_str) / "site-packages" - @classmethod def exe_names(cls, interpreter): return super(PyPy3, cls).exe_names(interpreter) | {"pypy"} @@ -33,6 +25,11 @@ def exe_names(cls, interpreter): class PyPy3Posix(PyPy3, PosixSupports): """PyPy 2 on POSIX""" + @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" + @classmethod def _shared_libs(cls): return ["libpypy3-c.so", "libpypy3-c.dylib"] @@ -53,6 +50,11 @@ def sources(cls, interpreter): class Pypy3Windows(PyPy3, WindowsSupports): """PyPy 2 on Windows""" + @property + def stdlib(self): + """PyPy3 respects sysconfig only for the host python, virtual envs is instead Lib/site-packages""" + return self.dest / "Lib" / "site-packages" + @property def bin_dir(self): """PyPy3 needs to fallback to pypy definition"""