diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-04-10 11:24:25 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-04-10 11:24:25 -0400 |
commit | 3b18e07289d1cd4cdd046d46c244d77938732e5e (patch) | |
tree | 891a80eac0ae9f431c4bcbe54be2342e86411248 /setuptools/command/easy_install.py | |
parent | fe3deeeebd6d5f01e803ea6bbfcf001834ca45b7 (diff) | |
download | python-setuptools-git-3b18e07289d1cd4cdd046d46c244d77938732e5e.tar.gz |
Consolidate technique for reading PYTHONPATH.
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 55d26560..e30ca3ac 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -474,8 +474,7 @@ class easy_install(Command): else: self.pth_file = None - PYTHONPATH = os.environ.get('PYTHONPATH', '').split(os.pathsep) - if instdir not in map(normalize_path, filter(None, PYTHONPATH)): + if instdir not in map(normalize_path, _pythonpath()): # only PYTHONPATH dirs need a site.py, so pretend it's there self.sitepy_installed = True elif self.multi_version and not os.path.exists(pth_file): @@ -1348,6 +1347,11 @@ class easy_install(Command): setattr(self, attr, val) +def _pythonpath(): + items = os.environ.get('PYTHONPATH', '').split(os.pathsep) + return filter(None, items) + + def get_site_dirs(): """ Return a list of 'site' dirs @@ -1356,8 +1360,7 @@ def get_site_dirs(): sitedirs = [] # start with PYTHONPATH - pythonpath_items = os.environ.get('PYTHONPATH', '').split(os.pathsep) - sitedirs.extend(filter(None, pythonpath_items)) + sitedirs.extend(_pythonpath()) prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: |