aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsetuptools/command/easy_install.py17
-rw-r--r--setuptools/py31compat.py11
2 files changed, 14 insertions, 14 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index fd133b6c..61d51450 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -32,19 +32,7 @@ from distutils import log, dir_util
import pkg_resources
from setuptools import Command, _dont_write_bytecode
from setuptools.sandbox import run_setup
-try:
- # Python 2.7 or >=3.2
- from sysconfig import get_config_vars, get_path
- def _get_platlib():
- return get_path("platlib")
- def _get_purelib():
- return get_path("purelib")
-except ImportError:
- from distutils.sysconfig import get_config_vars, get_python_lib
- def _get_platlib():
- return get_python_lib(True)
- def _get_purelib():
- return get_python_lib(False)
+from setuptools.py31compat import get_path, get_config_vars
from distutils.util import get_platform
from distutils.util import convert_path, subst_vars
@@ -1288,7 +1276,8 @@ def get_site_dirs():
'Python',
sys.version[:3],
'site-packages'))
- for site_lib in (_get_purelib(), _get_platlib()):
+ lib_paths = get_path('purelib'), get_path('platlib')
+ for site_lib in lib_paths:
if site_lib not in sitedirs: sitedirs.append(site_lib)
if HAS_USER_SITE:
diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py
new file mode 100644
index 00000000..dbb324b0
--- /dev/null
+++ b/setuptools/py31compat.py
@@ -0,0 +1,11 @@
+__all__ = ['get_config_vars', 'get_path']
+
+try:
+ # Python 2.7 or >=3.2
+ from sysconfig import get_config_vars, get_path
+except ImportError:
+ from distutils.sysconfig import get_config_vars, get_python_lib
+ def get_path(name):
+ if name not in ('platlib', 'purelib'):
+ raise ValueError("Name must be purelib or platlib")
+ return get_python_lib(name=='platlib')