[Python-checkins] r45556 - sandbox/branches/setuptools-0.6/setuptools/package_index.py

phillip.eby python-checkins at python.org
Wed Apr 19 02:21:59 CEST 2006


Author: phillip.eby
Date: Wed Apr 19 02:21:57 2006
New Revision: 45556

Modified:
   sandbox/branches/setuptools-0.6/setuptools/package_index.py
Log:
Backport support for file:// directory URLs in --find-links to 0.6
branch.


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	Wed Apr 19 02:21:57 2006
@@ -179,7 +179,7 @@
     def process_filename(self, fn, nested=False):
         # process filenames or directories
         if not os.path.exists(fn):
-            self.warn("Not found: %s", url)
+            self.warn("Not found: %s", fn)
             return
 
         if os.path.isdir(fn) and not nested:
@@ -260,7 +260,7 @@
 
     def find_packages(self, requirement):
         self.scan_url(self.index_url + requirement.unsafe_name+'/')
-        
+
         if not self.package_pages.get(requirement.key):
             # Fall back to safe version of the name
             self.scan_url(self.index_url + requirement.project_name+'/')
@@ -450,7 +450,7 @@
 
 
     def gen_setup(self, filename, fragment, tmpdir):
-        match = EGG_FRAGMENT.match(fragment); #import pdb; pdb.set_trace()
+        match = EGG_FRAGMENT.match(fragment)
         dists = match and [d for d in
             interpret_distro_name(filename, match.group(1), None) if d.version
         ] or []
@@ -489,7 +489,7 @@
                 "Can't process plain .py files without an '#egg=name-version'"
                 " suffix to enable automatic setup script generation."
             )
-        
+
     dl_blocksize = 8192
     def _download_to(self, url, filename):
         self.url_ok(url,True)   # raises error if not allowed
@@ -582,7 +582,6 @@
 
 
     def _download_url(self, scheme, url, tmpdir):
-
         # Determine download filename
         #
         name = filter(None,urlparse.urlparse(url)[2].split('/'))
@@ -602,6 +601,8 @@
         #
         if scheme=='svn' or scheme.startswith('svn+'):
             return self._download_svn(url, filename)
+        elif scheme=='file':
+            return urllib2.url2pathname(urlparse.urlparse(url)[2])
         else:
             headers = self.retry_sf_download(url, filename)
             if 'html' in headers['content-type'].lower():
@@ -612,7 +613,6 @@
     def scan_url(self, url):
         self.process_url(url, True)
 
-
     def _download_html(self, url, headers, filename, tmpdir):
         file = open(filename)
         for line in file:
@@ -694,4 +694,4 @@
 
 
 
-
+# this line is a kludge to keep the trailing blank lines for pje's editor


More information about the Python-checkins mailing list