[Checkins] SVN: zc.buildout/trunk/ 61890: file:// urls don't seem to work in find-links

Jim Fulton jim at zope.com
Sat May 12 11:11:31 EDT 2007


Log message for revision 75706:
  61890: file:// urls don't seem to work in find-links
  
  setuptools requires that file urls that point to directories must
  end in a "/".  Added a workaround.
  

Changed:
  U   zc.buildout/trunk/CHANGES.txt
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py
  U   zc.buildout/trunk/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt	2007-05-12 14:55:04 UTC (rev 75705)
+++ zc.buildout/trunk/CHANGES.txt	2007-05-12 15:11:31 UTC (rev 75706)
@@ -25,6 +25,11 @@
 
 - 59270: Buggy recipes can cause failures in later recipes via chdir
 
+- 61890: file:// urls don't seem to work in find-links
+
+  setuptools requires that file urls that point to directories must
+  end in a "/".  Added a workaround.
+
 1.0.0b24 (2007-05-09)
 =====================
 

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2007-05-12 14:55:04 UTC (rev 75705)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2007-05-12 15:11:31 UTC (rev 75706)
@@ -134,8 +134,10 @@
                                  " download cache")
             links = ()
             index = 'file://' + self._download_cache
+
         
-        self._links = links = list(links)
+        
+        self._links = links = list(_fix_file_links(links))
         if self._download_cache and (self._download_cache not in links):
             links.insert(0, self._download_cache)
 
@@ -973,3 +975,11 @@
                 seen.append(dist)
                 _needed(ws, dist, write, seen)
                 seen.pop()
+
+def _fix_file_links(links):
+    for link in links:
+        if link.startswith('file://') and link[-1] != '/':
+            if os.path.isdir(link[7:]):
+                # work around excessive restriction in setuptools:
+                link += '/'
+        yield link

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2007-05-12 14:55:04 UTC (rev 75705)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2007-05-12 15:11:31 UTC (rev 75706)
@@ -2036,7 +2036,31 @@
     
     """
 
+def bug_61890_file_urls_dont_seem_to_work_in_find_dash_links():
+    """
+    
+    This bug arises from the fact that setuptools is over restrictive
+    about file urls, requiring that file urls pointing at directories
+    must end in a slash.
 
+    >>> dest = tmpdir('sample-install')
+    >>> import zc.buildout.easy_install
+    >>> ws = zc.buildout.easy_install.install(
+    ...     ['demo==0.2'], dest,
+    ...     links=['file://'+sample_eggs], index=link_server+'index/')
+
+
+    >>> for dist in ws:
+    ...     print dist
+    demo 0.2
+    demoneeded 1.1
+
+    >>> ls(dest)
+    -  demo-0.2-py2.4.egg
+    -  demoneeded-1.1-py2.4.egg
+    
+    """
+
 ######################################################################
     
 def create_sample_eggs(test, executable=sys.executable):



More information about the Checkins mailing list