summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-12-17 10:15:07 -0500
committerJason R. Coombs <jaraco@jaraco.com>2021-12-17 10:15:07 -0500
commitda15b6e30ec48a3472b518b63c63ce6363b4e1cd (patch)
treee059e57f8eea0fd4b69fdfd03e5d9e144ca044f7
parent8c409a185b1a8258c32ba616fe9947043a04d184 (diff)
downloadpython-setuptools-git-da15b6e30ec48a3472b518b63c63ce6363b4e1cd.tar.gz
Extract _pypy_hack method.
-rw-r--r--distutils/command/install.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/distutils/command/install.py b/distutils/command/install.py
index df181102..407b96d6 100644
--- a/distutils/command/install.py
+++ b/distutils/command/install.py
@@ -517,19 +517,20 @@ class install(Command):
def select_scheme(self, name):
"""Sets the install directories by applying the install schemes."""
# it's the caller's problem if they supply a bad name!
- if (hasattr(sys, 'pypy_version_info') and
- sys.version_info < (3, 8) and
- not name.endswith(('_user', '_home'))):
- if os.name == 'nt':
- name = 'pypy_nt'
- else:
- name = 'pypy'
- scheme = _load_schemes()[name]
+ scheme = _load_schemes()[self._pypy_hack(name)]
for key in SCHEME_KEYS:
attrname = 'install_' + key
if getattr(self, attrname) is None:
setattr(self, attrname, scheme[key])
+ @staticmethod
+ def _pypy_hack(name):
+ PY37 = sys.version_info < (3, 8)
+ old_pypy = hasattr(sys, 'pypy_version_info') and PY37
+ prefix = not name.endswith(('_user', '_home'))
+ pypy_name = 'pypy' + '_nt' * (os.name == 'nt')
+ return pypy_name if old_pypy and prefix else name
+
def _expand_attrs(self, attrs):
for attr in attrs:
val = getattr(self, attr)