[Zope-Checkins] SVN: Zope/trunk/inst/generate_index.py support for external packages

Andreas Jung andreas at andreas-jung.com
Wed Apr 22 13:22:16 EDT 2009


Log message for revision 99391:
  support for external packages
  

Changed:
  U   Zope/trunk/inst/generate_index.py

-=-
Modified: Zope/trunk/inst/generate_index.py
===================================================================
--- Zope/trunk/inst/generate_index.py	2009-04-22 17:17:33 UTC (rev 99390)
+++ Zope/trunk/inst/generate_index.py	2009-04-22 17:22:16 UTC (rev 99391)
@@ -6,6 +6,7 @@
 
 import os
 import sys
+import urlparse
 from xmlrpclib import Server
 from ConfigParser import RawConfigParser as ConfigParser
 
@@ -23,12 +24,19 @@
     fp = file(index_html, 'w')
     print >>fp, '<html><body>'
     lst = server.package_urls(package, version)
-    if not lst:
-        raise RuntimeError('Package contains no release files: %s==%s' % (package, version))
-    for d in lst:
-        link = '<a href="%s">%s</a>' % (d['url'], d['filename'])
+    if lst:
+        for d in lst:
+            link = '<a href="%s">%s</a>' % (d['url'], d['filename'])
+            print >>fp, link
+            print >>fp, '<br/>'
+    else:
+        rel_data = server.release_data(package, version)
+        download_url = rel_data['download_url']
+        filename = os.path.basename(urlparse.urlparse(download_url)[2])
+        link = '<a href="%s">%s</a>' % (download_url, filename)
         print >>fp, link
         print >>fp, '<br/>'
+
     print >>fp, '</body></html>'
     fp.close()
 



More information about the Zope-Checkins mailing list