Skip to content

Commit 16944a6

Browse files
committed
Work around a bug in PyPy's sysconfig module
1 parent 0eae029 commit 16944a6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pip/locations.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
import os
55
import os.path
6+
import platform
67
import site
78
import sys
89
import sysconfig
910

11+
from distutils import sysconfig as distutils_sysconfig
1012
from distutils.command.install import install, SCHEME_KEYS # noqa
1113

1214
from pip.compat import WINDOWS, expanduser
@@ -81,6 +83,11 @@ def virtualenv_no_global():
8183
# FIXME doesn't account for venv linked to global site-packages
8284

8385
site_packages = sysconfig.get_path("purelib")
86+
# This is because of a bug in PyPy's sysconfig module, see
87+
# https://bitbucket.org/pypy/pypy/issues/2506/sysconfig-returns-incorrect-paths
88+
# for more information.
89+
if platform.python_implementation().lower() == "pypy":
90+
site_packages = distutils_sysconfig.get_python_lib()
8491
user_site = site.USER_SITE
8592
user_dir = expanduser('~')
8693
if WINDOWS:

0 commit comments

Comments
 (0)