[Python-checkins] r46712 - sandbox/branches/setuptools-0.6/pkg_resources.py sandbox/branches/setuptools-0.6/pkg_resources.txt
phillip.eby
python-checkins at python.org
Wed Jun 7 20:31:06 CEST 2006
Author: phillip.eby
Date: Wed Jun 7 20:31:05 2006
New Revision: 46712
Modified:
sandbox/branches/setuptools-0.6/pkg_resources.py
sandbox/branches/setuptools-0.6/pkg_resources.txt
Log:
Fixed a duplicate path insertion problem on case-insensitive
filesystems. (Merge from 0.7 trunk)
Modified: sandbox/branches/setuptools-0.6/pkg_resources.py
==============================================================================
--- sandbox/branches/setuptools-0.6/pkg_resources.py (original)
+++ sandbox/branches/setuptools-0.6/pkg_resources.py Wed Jun 7 20:31:05 2006
@@ -2112,22 +2112,63 @@
"""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):
Modified: sandbox/branches/setuptools-0.6/pkg_resources.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/pkg_resources.txt (original)
+++ sandbox/branches/setuptools-0.6/pkg_resources.txt Wed Jun 7 20:31:05 2006
@@ -1662,6 +1662,9 @@
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
More information about the Python-checkins
mailing list