summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2008-09-24 17:20:09 +0000
committerphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2008-09-24 17:20:09 +0000
commit5453f0a279b620a1c972a469e115aedc288fa8da (patch)
treef8a41e040a7c784040831ccf23b6e1cfc956138b
parentdb607ea9eaaa81175bfdfc0b4a1784439ee5376c (diff)
downloadpython-setuptools-5453f0a279b620a1c972a469e115aedc288fa8da.tar.gz
Keep site directories (e.g. site-packages) from being included in
.pth files. git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@66608 6015fed2-1504-0410-9fe1-9d1591cc4771
-rwxr-xr-xsetuptools/command/easy_install.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 0f7709a..4d12d04 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -272,7 +272,7 @@ class easy_install(Command):
if is_site_dir:
if self.pth_file is None:
- self.pth_file = PthDistributions(pth_file)
+ self.pth_file = PthDistributions(pth_file, self.all_site_dirs)
else:
self.pth_file = None
@@ -1315,8 +1315,8 @@ class PthDistributions(Environment):
dirty = False
- def __init__(self, filename):
- self.filename = filename
+ def __init__(self, filename, sitedirs=()):
+ self.filename = filename; self.sitedirs=map(normalize_path, sitedirs)
self.basedir = normalize_path(os.path.dirname(self.filename))
self._load(); Environment.__init__(self, [], None, None)
for path in yield_lines(self.paths):
@@ -1325,7 +1325,7 @@ class PthDistributions(Environment):
def _load(self):
self.paths = []
saw_import = False
- seen = {}
+ seen = dict.fromkeys(self.sitedirs)
if os.path.isfile(self.filename):
for line in open(self.filename,'rt'):
if line.startswith('import'):
@@ -1381,7 +1381,7 @@ class PthDistributions(Environment):
def add(self,dist):
"""Add `dist` to the distribution map"""
- if dist.location not in self.paths:
+ if dist.location not in self.paths and dist.location not in self.sitedirs:
self.paths.append(dist.location); self.dirty = True
Environment.add(self,dist)