summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLast G <last_g@hackerdom.ru>2016-05-19 11:35:18 +0200
committerLast G <last_g@hackerdom.ru>2016-05-19 11:35:18 +0200
commit6437f524bd60e943be9415818f1554bfda56920f (patch)
tree59438a58be2e8bf5f70a4dce128d4958c66e9f5f
parent41d0279e41eaa5bc948bd7d6b815212e8d99e1fc (diff)
downloadpython-setuptools-git-6437f524bd60e943be9415818f1554bfda56920f.tar.gz
Get site-packages dirs from site.py too
-rwxr-xr-xsetuptools/command/easy_install.py5
-rw-r--r--setuptools/tests/test_easy_install.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index ea5cb028..0bd3ea45 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1347,6 +1347,11 @@ def get_site_dirs():
if site.ENABLE_USER_SITE:
sitedirs.append(site.USER_SITE)
+ try:
+ sitedirs.extend(site.getsitepackages())
+ except AttributeError:
+ pass
+
sitedirs = list(map(normalize_path, sitedirs))
return sitedirs
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 55b8b05a..b9f820d8 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -119,6 +119,10 @@ class TestEasyInstallTest:
with pytest.raises(distutils.errors.DistutilsError):
cmd.cant_write_to_target()
+ @mock.patch('site.getsitepackages', lambda: ['/setuptools/test/site-packages'])
+ def test_all_site_dirs(self):
+ assert '/setuptools/test/site-packages' in ei.get_site_dirs()
+
class TestPTHFileWriter:
def test_add_from_cwd_site_sets_dirty(self):