Commit 554ded3e authored by Sviatoslav Sydorenko's avatar Sviatoslav Sydorenko

Simplify `command.easy_install.get_site_dirs`

parent b5fdca1e
......@@ -1371,7 +1371,9 @@ def get_site_dirs():
if sys.exec_prefix != sys.prefix:
prefixes.append(sys.exec_prefix)
for prefix in prefixes:
if prefix:
if not prefix:
continue
if sys.platform in ('os2emx', 'riscos'):
sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
......@@ -1389,13 +1391,19 @@ def get_site_dirs():
prefix,
os.path.join(prefix, "lib", "site-packages"),
])
if sys.platform == 'darwin':
if sys.platform != 'darwin':
continue
# for framework builds *only* we add the standard Apple
# locations. Currently only per-user, but /Library and
# /Network/Library could be added too
if 'Python.framework' in prefix:
if 'Python.framework' not in prefix:
continue
home = os.environ.get('HOME')
if home:
if not home:
continue
home_sp = os.path.join(
home,
'Library',
......@@ -1405,17 +1413,14 @@ def get_site_dirs():
)
sitedirs.append(home_sp)
lib_paths = get_path('purelib'), get_path('platlib')
for site_lib in lib_paths:
if site_lib not in sitedirs:
sitedirs.append(site_lib)
sitedirs.extend(s for s in lib_paths if s not in sitedirs)
if site.ENABLE_USER_SITE:
sitedirs.append(site.USER_SITE)
try:
with contextlib.suppress(AttributeError):
sitedirs.extend(site.getsitepackages())
except AttributeError:
pass
sitedirs = list(map(normalize_path, sitedirs))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment