Anonymous avatar Anonymous committed 939d65e

Fixed a duplicate path insertion problem on case-insensitive
filesystems. (Merge from 0.7 trunk)

Comments (0)

Files changed (2)

         """Return the EntryPoint object for `group`+`name`, or ``None``"""
         return self.get_entry_map(group).get(name)
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     def insert_on(self, path, loc = None):
         """Insert self.location in path before its nearest parent directory"""
+
         loc = loc or self.location
-        if not loc: return
+        if not loc:
+            return
+
         if path is sys.path:
             self.check_version_conflict()
-        best, pos = 0, -1
-        for p,item in enumerate(path):
-            item = _normalize_cached(item)
-            if loc.startswith(item) and len(item)>best and loc<>item:
-                best, pos = len(item), p
-        if pos==-1:
-            if loc not in path: path.append(loc)
-        elif loc not in path[:pos+1]:
-            while loc in path: path.remove(loc)
-            path.insert(pos,loc)
+
+        nloc = _normalize_cached(loc)
+        bdir = os.path.dirname(nloc)
+        npath= map(_normalize_cached, path)
+
+        bp = None
+        for p, item in enumerate(npath):
+            if item==nloc:
+                break
+            elif item==bdir:
+                path.insert(p, loc)
+                npath.insert(p, nloc)
+                break
+        else:
+            path.append(loc)
+            return
+
+        # p is the spot where we found or inserted loc; now remove duplicates
+        while 1:
+            try:
+                np = npath.index(nloc, p+1)
+            except ValueError:
+                break
+            else:
+                del npath[np], path[np]
+                p = np  # ha!
+
+        return
+
+
 
 
     def check_version_conflict(self):

pkg_resources.txt

 Release Notes/Change History
 ----------------------------
 
+0.6b3
+ * Fixed a duplicate path insertion problem on case-insensitive filesystems.
+
 0.6b1
  * Split ``get_platform()`` into ``get_supported_platform()`` and
    ``get_build_platform()`` to work around a Mac versioning problem that caused
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.