[Zope-Checkins] SVN: Zope/trunk/inst/generate_index.py generating a proper directory structure
Andreas Jung
andreas at andreas-jung.com
Tue Apr 21 07:41:34 EDT 2009
Log message for revision 99349:
generating a proper directory structure
Changed:
U Zope/trunk/inst/generate_index.py
-=-
Modified: Zope/trunk/inst/generate_index.py
===================================================================
--- Zope/trunk/inst/generate_index.py 2009-04-21 11:28:08 UTC (rev 99348)
+++ Zope/trunk/inst/generate_index.py 2009-04-21 11:41:33 UTC (rev 99349)
@@ -1,9 +1,10 @@
"""
Generate an index file based on the version.cfg file of Zope 2
in order to provide a version specific index page generated to be used
-in combination with easy_install -i <some_url>/index.html
+in combination with easy_install -i <some_url>
"""
+import os
import sys
from xmlrpclib import Server
from ConfigParser import ConfigParser
@@ -14,17 +15,21 @@
server = Server('http://pypi.python.org/pypi')
links = list()
+dirname = sys.argv[1]
+
for package in CP.options('versions'):
version = CP.get('versions', package)
print >>sys.stderr, 'Package %s==%s' % (package, version)
+ dest_dir = os.path.join(dirname, package)
+ if not os.path.exists(dest_dir):
+ os.makedirs(dest_dir)
+ index_html = os.path.join(dest_dir, 'index.html')
+
+ fp = file(index_html, 'w')
+ print >>fp, '<html><body>'
for d in server.package_urls(package, version):
- links.append('<a href="%s">%s</a>' % (d['url'], d['filename']))
-
-fp = file('index.html', 'w')
-print >>fp, '<html><body>'
-for link in links:
- print >>fp, link
- print >>fp, '<br/>'
-print >>fp, '</body></html>'
-
-fp.close()
+ link = '<a href="%s">%s</a>' % (d['url'], d['filename'])
+ print >>fp, link
+ print >>fp, '<br/>'
+ print >>fp, '</body></html>'
+ fp.close()
More information about the Zope-Checkins
mailing list