Commits

phillip.eby  committed 541c354

Keep site directories (e.g. site-packages) from being included in
.pth files. (backport from trunk)

  • Participants
  • Parent commits 16ac56d
  • Branches setuptools-0.6

Comments (0)

Files changed (2)

File EasyInstall.txt

 
  * Removed use of deprecated ``md5`` module if ``hashlib`` is available
 
+ * Keep site directories (e.g. ``site-packages``) from being included in
+   ``.pth`` files.
 
 0.6c7
  * ``ftp:`` download URLs now work correctly.

File setuptools/command/easy_install.py

 
         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
 
 
     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):
     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'):
 
     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)