forked from youngpm/gdalmanylinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_index.py
executable file
·37 lines (31 loc) · 1019 Bytes
/
make_index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# Original code from https://github.com/girder/large_image_wheels
# Author: David Manthey <[email protected]>
# Licence: Apache Licence 2.0
# Modified by Someware-fr
import os
import sys
import time
path = 'gh-pages' if len(sys.argv) == 1 else sys.argv[1]
indexName = 'index.html'
template = """<html>
<head><title>someGDALware</title></head>
<body>
<h1>someGDALware</h1>
<pre>
%LINKS%
</pre>
</body>
"""
link = '<a href="%s" download="%s">%s</a>%s%s%11d'
wheels = [(name, name) for name in os.listdir(path) if name.endswith('whl')]
wheels = sorted(wheels)
maxnamelen = max(len(name) for name, url in wheels)
index = template.replace('%LINKS%', '\n'.join([
link % (
url, name, name, ' ' * (maxnamelen + 3 - len(name)),
time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(os.path.getmtime(
os.path.join(path, name)))),
os.path.getsize(os.path.join(path, name)),
) for name, url in wheels]))
open(os.path.join(path, indexName), 'w').write(index)