[Python-checkins] r66608 - sandbox/trunk/setuptools/setuptools/command/easy_install.py
phillip.eby
python-checkins at python.org
Wed Sep 24 19:20:09 CEST 2008
Author: phillip.eby
Date: Wed Sep 24 19:20:09 2008
New Revision: 66608
Log:
Keep site directories (e.g. site-packages) from being included in
.pth files.
Modified:
sandbox/trunk/setuptools/setuptools/command/easy_install.py
Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py Wed Sep 24 19:20:09 2008
@@ -272,7 +272,7 @@
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 @@
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 @@
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 @@
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)
More information about the Python-checkins
mailing list