Commit ad6f21da authored by Andreas Jung's avatar Andreas Jung

support for external packages

parent 4f29cfee
...@@ -6,6 +6,7 @@ in combination with easy_install -i <some_url> ...@@ -6,6 +6,7 @@ in combination with easy_install -i <some_url>
import os import os
import sys import sys
import urlparse
from xmlrpclib import Server from xmlrpclib import Server
from ConfigParser import RawConfigParser as ConfigParser from ConfigParser import RawConfigParser as ConfigParser
...@@ -23,12 +24,19 @@ def write_index(package, version): ...@@ -23,12 +24,19 @@ def write_index(package, version):
fp = file(index_html, 'w') fp = file(index_html, 'w')
print >>fp, '<html><body>' print >>fp, '<html><body>'
lst = server.package_urls(package, version) lst = server.package_urls(package, version)
if not lst: if lst:
raise RuntimeError('Package contains no release files: %s==%s' % (package, version)) for d in lst:
for d in lst: link = '<a href="%s">%s</a>' % (d['url'], d['filename'])
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, link
print >>fp, '<br/>' print >>fp, '<br/>'
print >>fp, '</body></html>' print >>fp, '</body></html>'
fp.close() 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