[Python-checkins] r45984 - sandbox/branches/setuptools-0.6/setuptools/package_index.py
phillip.eby
python-checkins at python.org
Sat May 13 00:17:31 CEST 2006
Author: phillip.eby
Date: Sat May 13 00:17:31 2006
New Revision: 45984
Modified:
sandbox/branches/setuptools-0.6/setuptools/package_index.py
Log:
Better ambiguity management: accept #egg name/version even if processing
what appears to be a correctly-named distutils file, and ignore .egg
files with no '-', since valid Python .egg files always have a version
number (but Scheme eggs often don't).
Modified: sandbox/branches/setuptools-0.6/setuptools/package_index.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/package_index.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/package_index.py Sat May 13 00:17:31 2006
@@ -48,20 +48,21 @@
def distros_for_url(url, metadata=None):
"""Yield egg or source distribution objects that might be found at a URL"""
base, fragment = egg_info_for_url(url)
- dists = distros_for_location(url, base, metadata)
- if fragment and not dists:
+ for dist in distros_for_location(url, base, metadata): yield dist
+ if fragment:
match = EGG_FRAGMENT.match(fragment)
if match:
- return interpret_distro_name(
+ for dist in interpret_distro_name(
url, match.group(1), metadata, precedence = CHECKOUT_DIST
- )
- return dists
+ ):
+ yield dist
def distros_for_location(location, basename, metadata=None):
"""Yield egg or source distribution objects based on basename"""
if basename.endswith('.egg.zip'):
basename = basename[:-4] # strip the .zip
- if basename.endswith('.egg'): # only one, unambiguous interpretation
+ if basename.endswith('.egg') and '-' in basename:
+ # only one, unambiguous interpretation
return [Distribution.from_location(location, basename, metadata)]
if basename.endswith('.exe'):
@@ -79,7 +80,6 @@
return interpret_distro_name(location, basename, metadata)
return [] # no extension matched
-
def distros_for_filename(filename, metadata=None):
"""Yield possible egg or source distribution objects based on a filename"""
return distros_for_location(
More information about the Python-checkins
mailing list