[Checkins] SVN: hurry.yui/trunk/src/hurry/yui/ Update to work with new YUI release structure.

Martijn Faassen faassen at startifact.com
Mon Sep 7 16:20:23 EDT 2009


Log message for revision 103614:
  Update to work with new YUI release structure.
  

Changed:
  U   hurry.yui/trunk/src/hurry/yui/download.py
  U   hurry.yui/trunk/src/hurry/yui/prepare.py

-=-
Modified: hurry.yui/trunk/src/hurry/yui/download.py
===================================================================
--- hurry.yui/trunk/src/hurry/yui/download.py	2009-09-07 16:06:32 UTC (rev 103613)
+++ hurry.yui/trunk/src/hurry/yui/download.py	2009-09-07 20:20:23 UTC (rev 103614)
@@ -2,7 +2,7 @@
 import tempfile, shutil
 import os
 
-SF_URL_TEMPLATE = 'http://sourceforge.net/project/downloading.php?group_id=165715&filename=yui_%s.zip'
+URL_TEMPLATE = 'http://yuilibrary.com/downloads/yui2/yui_%s.zip'
 
 def download(version, callback):
     """Download a yui of version.
@@ -11,13 +11,8 @@
     with an extracted YUI. The callback will then be able to copy
     this to the appropriate location.
     """
-    url = SF_URL_TEMPLATE % version
-    f = urllib2.urlopen(url)
-    data = f.read()
-    f.close()
-
-    download_url = find_a_href(data, 'direct link')
-
+    download_url = URL_TEMPLATE % version
+   
     f = urllib2.urlopen(download_url)
     file_data = f.read()
     f.close()
@@ -33,13 +28,3 @@
         callback(ex_path)
     finally:
         shutil.rmtree(dirpath, ignore_errors=True)
-
-def find_a_href(data, content):
-    """Given start of content of the <a href="">content</a> find href.
-    """
-    i = data.find(content)
-    a = '<a href="'
-    href_start = data.rfind(a, 0, i)
-    href_start += len(a)
-    href_end = data.find('"', href_start)
-    return data[href_start:href_end]

Modified: hurry.yui/trunk/src/hurry/yui/prepare.py
===================================================================
--- hurry.yui/trunk/src/hurry/yui/prepare.py	2009-09-07 16:06:32 UTC (rev 103613)
+++ hurry.yui/trunk/src/hurry/yui/prepare.py	2009-09-07 20:20:23 UTC (rev 103614)
@@ -8,9 +8,14 @@
     try:
         version = sys.argv[1]
     except IndexError:
-        print "Usage: yuiprepare <YUI version>"
+        print "Usage: yuiprepare <YUI version> [<download version>]"
         return
 
+    try:
+        download_version = sys.argv[2]
+    except IndexError:
+        download_version = version
+    
     # download YUI library into package
     package_dir = os.path.dirname(__file__)
     yui_dest_path = os.path.join(package_dir, 'yui-build')
@@ -23,7 +28,7 @@
         yui_build_path = os.path.join(ex_path, 'yui', 'build')
         shutil.copytree(yui_build_path, yui_dest_path)
 
-    download(version, copy_yui)
+    download(download_version, copy_yui)
 
     # get dependency structure and create 'yui.py' into package
     code = depend(version)



More information about the checkins mailing list