diff options
| author | PJ Eby <distutils-sig@python.org> | 2005-04-03 01:21:08 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2005-04-03 01:21:08 +0000 |
| commit | 28db19795dbc9890003406a7ac8f6ca71ff7c03c (patch) | |
| tree | 7ff782a51e5495e0a250a2c9b27561825a5b21b3 /pkg_resources.py | |
| parent | 7311c34af4aa1ab305021fa9df99eaf63bb15ebe (diff) | |
| download | python-setuptools-git-28db19795dbc9890003406a7ac8f6ca71ff7c03c.tar.gz | |
Fix handling of -/_ so that they are canonicalized to '-' when doing name
or version comparisons, but rendered as '_' in egg filenames.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041002
Diffstat (limited to 'pkg_resources.py')
| -rw-r--r-- | pkg_resources.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index d4b1f27b..f034be61 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -623,6 +623,7 @@ class Distribution(object): 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 @@ class Distribution(object): parsed_version = property(parsed_version) - def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` @@ -681,7 +681,8 @@ def parse_requirements(strs): 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 @@ def parse_requirements(strs): elif not LINE_END(line,p): raise ValueError("Expected ',' or EOL in",line,"at",line[p:]) - yield distname, specs + yield distname.replace('_','-'), specs |
