[Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.7, 1.8

pje at users.sourceforge.net pje at users.sourceforge.net
Sun Apr 3 03:21:11 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15837

Modified Files:
	pkg_resources.py 
Log Message:
Fix handling of -/_ so that they are canonicalized to '-' when doing name
or version comparisons, but rendered as '_' in egg filenames.


Index: pkg_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pkg_resources.py	3 Apr 2005 00:46:56 -0000	1.7
+++ pkg_resources.py	3 Apr 2005 01:21:08 -0000	1.8
@@ -623,6 +623,7 @@
                 name,version,py_version,platform = match.group(
                     'name','ver','pyver','plat'
                 )
+                name = name.replace('_','-')
                 if version and '_' in version:
                     version = version.replace('_','-')
         return cls(
@@ -653,7 +654,6 @@
 
     parsed_version = property(parsed_version)
     
-
 def parse_requirements(strs):
     """Yield ``Requirement`` objects for each specification in `strs`
 
@@ -681,7 +681,8 @@
             match = VERSION(line,p)
             if not match:
                 raise ValueError("Expected version spec in",line,"at",line[p:])
-            specs.append(match.group(1,2))
+            op,val = match.group(1,2)
+            specs.append((op,val.replace('_','-')))
             p = match.end()
             match = COMMA(line,p)
             if match:
@@ -689,7 +690,7 @@
             elif not LINE_END(line,p):
                 raise ValueError("Expected ',' or EOL in",line,"at",line[p:])
 
-        yield distname, specs
+        yield distname.replace('_','-'), specs
 
 
 



More information about the Python-checkins mailing list