changeset 5331:b676a7b1ac1e

Some download cache fixes. Now, doing in a fresh directory GUB_DOWNLOAD_CACHE=file:///home/janneke/vc/gub/downloads bin/gub --download-only mingw::denemo almost works, except for GIT which still pulls from remote.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Thu, 09 Jul 2009 15:13:16 +0200
parents 8729aaad7da1
children 7c2ea1c8f1e2
files gub/misc.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gub/misc.py	Thu Jul 09 15:12:11 2009 +0200
+++ b/gub/misc.py	Thu Jul 09 15:13:16 2009 +0200
@@ -280,7 +280,7 @@
     assert type (fallback) == list
 
     candidate_urls = []
-    for url in local + cache + [original_url] + fallback:
+    for url in local + cache + [cache[0] + '/cross', cache[0] + '/' + os.path.basename (dest_dir)] + [original_url] + fallback:
         if not url:
             continue
         if os.path.exists (url):
@@ -306,7 +306,8 @@
         url_stream = urllib2.urlopen (url)
     except:
         t, v, b = sys.exc_info ()
-        if ((t == OSError and url.startswith ('file:'))
+        if (((t == OSError or t == urllib2.URLError)
+             and url.startswith ('file:'))
             or ((t == IOError or t == urllib2.HTTPError)
                 and (url.startswith ('ftp:') or url.startswith ('http:')))):
             return v