Skip to content

Instantly share code, notes, and snippets.

@mwcraig
Created May 18, 2014 20:39
Show Gist options
  • Select an option

  • Save mwcraig/61291289b892b5014472 to your computer and use it in GitHub Desktop.

Select an option

Save mwcraig/61291289b892b5014472 to your computer and use it in GitHub Desktop.
Originally from Stuart Mumford/sunpy, I think...
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 31 18:29:35 2013
@author: stuart
"""
from __future__ import print_function
import os
header = [
'<html>\n',
'<head>\n',
'<title>Wheelhouse Spoke</title>\n',
'</head>\n',
'<body>\n'
]
for root, direc, files in os.walk('.'):
wheels = []
print("In {}", root)
for f in files:
if os.path.splitext(f)[1] == '.whl':
wheels.append(f)
if wheels:
wheels.sort()
outf = open(os.path.join(root, "index.html"), 'w')
outf.writelines(header)
for wheel in wheels:
outf.write("<a href=%s>%s</a></br>\n" % (wheel, wheel))
outf.write("</body>\n")
outf.write("</html>\n")
outf.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment