diff options
author | PJ Eby <distutils-sig@python.org> | 2005-07-07 16:28:43 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-07-07 16:28:43 +0000 |
commit | c1112aa5fb7da9996e5a0ebe8689e5cf9ca72cee (patch) | |
tree | 06d3d26a04aae3e25b0edc503b24f606cb76baef /setuptools/package_index.py | |
parent | 61d2fd1d71e8940531c35327e6d91c41ddcd9dbd (diff) | |
download | python-setuptools-git-c1112aa5fb7da9996e5a0ebe8689e5cf9ca72cee.tar.gz |
Add upload support to setuptools, and make default downloads of setuptools
come from PyPI/python.org rather than from telecommunity.com. Bump to
version 0.5a7.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041090
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 78962eee..0a8ccddc 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -44,7 +44,9 @@ def distros_for_url(url, metadata=None): path = urlparse.urlparse(url)[2] base = urllib2.unquote(path.split('/')[-1]) - + if base.endswith('.egg.zip'): + base = base[:-4] # strip the .zip + if base.endswith('.egg'): dist = Distribution.from_filename(base, metadata) dist.path = url @@ -58,10 +60,10 @@ def distros_for_url(url, metadata=None): ) # Try source distro extensions (.zip, .tgz, etc.) - # + # for ext in EXTENSIONS: if base.endswith(ext): - base = base[:-len(ext)] + base = base[:-len(ext)] return interpret_distro_name(url, base, metadata) return [] # no extension matched @@ -78,8 +80,6 @@ def distros_for_url(url, metadata=None): - - def interpret_distro_name(url, base, metadata, py_version=None, distro_type=SOURCE_DIST, platform=None ): @@ -139,7 +139,7 @@ class PackageIndex(AvailableDistributions): dists = list(distros_for_url(url)) if dists: self.debug("Found link: %s", url) - if dists or not retrieve or url in self.fetched_urls: + if dists or not retrieve or url in self.fetched_urls: for dist in dists: self.add(dist) # don't need the actual page @@ -164,7 +164,7 @@ class PackageIndex(AvailableDistributions): def process_index(self,url,page): """Process the contents of a PyPI page""" - + def scan(link): # Process a URL to see if it's for a package page if link.startswith(self.index_url): @@ -226,7 +226,7 @@ class PackageIndex(AvailableDistributions): for dist in self.get(requirement.key, ()): if dist in requirement: return dist - self.debug("%s does not match %s", requirement, dist) + self.debug("%s does not match %s", requirement, dist) return super(PackageIndex, self).obtain(requirement,installer) @@ -388,6 +388,9 @@ class PackageIndex(AvailableDistributions): else: name = "__downloaded__" # default if URL has no path contents + if name.endswith('.egg.zip'): + name = name[:-4] # strip the extra .zip before download + filename = os.path.join(tmpdir,name) # Download the file @@ -405,9 +408,6 @@ class PackageIndex(AvailableDistributions): self.process_url(url, True) - - - def _download_html(self, url, headers, filename, tmpdir): # Check for a sourceforge URL sf_url = url.startswith('http://prdownloads.') @@ -445,7 +445,7 @@ class PackageIndex(AvailableDistributions): def info(self, msg, *args): log.info(msg, *args) - + def warn(self, msg, *args): log.warn(msg, *args) |