Commit f73e357f authored by Andreas Jung's avatar Andreas Jung

generating a proper directory structure

parent c34f8161
"""
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 @@ CP.read(['versions.cfg'])
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)
for d in server.package_urls(package, version):
links.append('<a href="%s">%s</a>' % (d['url'], d['filename']))
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 link in links:
print >>fp, link
print >>fp, '<br/>'
print >>fp, '</body></html>'
fp.close()
fp = file(index_html, 'w')
print >>fp, '<html><body>'
for d in server.package_urls(package, version):
link = '<a href="%s">%s</a>' % (d['url'], d['filename'])
print >>fp, link
print >>fp, '<br/>'
print >>fp, '</body></html>'
fp.close()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment