Browse Source

automatic file md5s for download page

pull/1/head
Sami Vaarala 11 years ago
parent
commit
a0742632ba
  1. 23
      website/buildsite.py
  2. 22
      website/download/download.html

23
website/buildsite.py

@ -9,6 +9,7 @@ import shutil
import re
import tempfile
import atexit
import md5
from bs4 import BeautifulSoup
colorize = True
@ -73,6 +74,14 @@ def rst2Html(filename):
return res
def getFileMd5(filename):
if not os.path.exists(filename):
return None
f = open(filename, 'rb')
d = f.read()
f.close()
return md5.md5(d).digest().encode('hex')
def stripNewline(x):
if len(x) > 0 and x[-1] == '\n':
return x[:-1]
@ -619,6 +628,20 @@ def generateDownloadPage(releases_filename):
pre_elem.string = f.read().decode('utf-8')
f.close()
# automatic md5sums for downloadable files
# <tr><td class="reldate">2013-09-21</td>
# <td class="filename"><a href="duktape-0.6.0.tar.xz">duktape-0.6.0.tar.xz</a></td>
# <td class="description">alpha, first round of work on public API</td>
# <td class="hash">fa384a42a27d996313e0192c51c50b4a</td></tr>
for tr in down_soup.select('tr'):
tmp = tr.select('.filename')
if len(tmp) != 1:
continue
href = tmp[0].select('a')[0]['href']
hash_elem = tr.select('.hash')[0]
hash_elem.string = getFileMd5(os.path.abspath(os.path.join('binaries', href))) or '???'
tmp_soup = templ_soup.select('#site-middle')[0]
tmp_soup.clear()
for i in down_soup.select('body')[0]:

22
website/download/download.html

@ -9,9 +9,9 @@
<tr><th>Date</th><th>Filename</th><th>Description</th><th>MD5</th></tr>
</thead>
<tbody>
<tr><td class="reldate">2013-09-21</td><td class="filename"><a href="duktape-0.6.0.tar.xz">duktape-0.6.0.tar.xz</a></td><td class="description">alpha, first round of work on public API</td><td class="hash">fa384a42a27d996313e0192c51c50b4a</td></tr>
<tr><td class="reldate">2013-10-30</td><td class="filename"><a href="duktape-0.7.0.tar.xz">duktape-0.7.0.tar.xz</a></td><td class="description">alpha, tracebacks, portability fixes</td><td class="hash">120978321dbf1f094fb893c945209179</td></tr>
<tr class="latest"><td class="reldate">2013-12-18</td><td class="filename"><a href="duktape-0.8.0.tar.xz">duktape-0.8.0.tar.xz</a></td><td class="description">alpha, E5.1 fixes, compiler limit fixes</td><td class="hash">FIXME</td></tr>
<tr><td class="reldate">2013-09-21</td><td class="filename"><a href="duktape-0.6.0.tar.xz">duktape-0.6.0.tar.xz</a></td><td class="description">alpha, first round of work on public API</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-10-30</td><td class="filename"><a href="duktape-0.7.0.tar.xz">duktape-0.7.0.tar.xz</a></td><td class="description">alpha, tracebacks, portability fixes</td><td class="hash">XXX</td></tr>
<tr class="latest"><td class="reldate">2013-12-18</td><td class="filename"><a href="duktape-0.8.0.tar.xz">duktape-0.8.0.tar.xz</a></td><td class="description">alpha, E5.1 fixes, compiler limit fixes</td><td class="hash">XXX</td></tr>
</tbody>
</table>
@ -23,14 +23,14 @@ stuff. You only need a full release if you intend to change the internals of Du
<tr><th>Date</th><th>Filename</th><th>Description</th><th>MD5</th></tr>
</thead>
<tbody>
<tr><td class="reldate">2013-02-14</td><td class="filename"><a href="duktape-full-0.1.0.tar.xz">duktape-full-0.1.0.tar.xz</a></td><td class="description">early alpha, missing most built-ins</td><td class="hash">4ccc9fd497b88cd669937808573bd91e</td></tr>
<tr><td class="reldate">2013-02-27</td><td class="filename"><a href="duktape-full-0.2.0.tar.xz">duktape-full-0.2.0.tar.xz</a></td><td class="description">early alpha, Boolean, Date, and JSON added, missing built-ins</td><td class="hash">7fcc55e9ad32e204761c48667dd5d359</td></tr>
<tr><td class="reldate">2013-03-16</td><td class="filename"><a href="duktape-full-0.3.0.tar.xz">duktape-full-0.3.0.tar.xz</a></td><td class="description">early alpha, global object, Object, String added, missing built-ins</td><td class="hash">9fecfa2c3d5e99efc53d64b653556ba7</td></tr>
<tr><td class="reldate">2013-03-31</td><td class="filename"><a href="duktape-full-0.4.0.tar.xz">duktape-full-0.4.0.tar.xz</a></td><td class="description">early alpha, Array, Number added, completing built-ins</td><td class="hash">86e2452a895192370b19a0861565c8d7</td></tr>
<tr><td class="reldate">2013-05-17</td><td class="filename"><a href="duktape-full-0.5.0.tar.xz">duktape-full-0.5.0.tar.xz</a></td><td class="description">alpha, built-in number conversion primitives</td><td class="hash">987e83e0fa0197288d06a601129c845c</td></tr>
<tr><td class="reldate">2013-09-21</td><td class="filename"><a href="duktape-full-0.6.0.tar.xz">duktape-full-0.6.0.tar.xz</a></td><td class="description">(see above)</td><td class="hash">e37c151a1c0efab3c63aa30b7164d346</td></tr>
<tr><td class="reldate">2013-10-30</td><td class="filename"><a href="duktape-full-0.7.0.tar.xz">duktape-full-0.7.0.tar.xz</a></td><td class="description">(see above)</td><td class="hash">f98e986882aca79a467a127146ebfae0</td></tr>
<tr class="latest"><td class="reldate">2013-12-18</td><td class="filename"><a href="duktape-full-0.8.0.tar.xz">duktape-full-0.8.0.tar.xz</a></td><td class="description">(see above)</td><td class="hash">FIXME</td></tr>
<tr><td class="reldate">2013-02-14</td><td class="filename"><a href="duktape-full-0.1.0.tar.xz">duktape-full-0.1.0.tar.xz</a></td><td class="description">early alpha, missing most built-ins</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-02-27</td><td class="filename"><a href="duktape-full-0.2.0.tar.xz">duktape-full-0.2.0.tar.xz</a></td><td class="description">early alpha, Boolean, Date, and JSON added, missing built-ins</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-03-16</td><td class="filename"><a href="duktape-full-0.3.0.tar.xz">duktape-full-0.3.0.tar.xz</a></td><td class="description">early alpha, global object, Object, String added, missing built-ins</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-03-31</td><td class="filename"><a href="duktape-full-0.4.0.tar.xz">duktape-full-0.4.0.tar.xz</a></td><td class="description">early alpha, Array, Number added, completing built-ins</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-05-17</td><td class="filename"><a href="duktape-full-0.5.0.tar.xz">duktape-full-0.5.0.tar.xz</a></td><td class="description">alpha, built-in number conversion primitives</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-09-21</td><td class="filename"><a href="duktape-full-0.6.0.tar.xz">duktape-full-0.6.0.tar.xz</a></td><td class="description">(see above)</td><td class="hash">XXX</td></tr>
<tr><td class="reldate">2013-10-30</td><td class="filename"><a href="duktape-full-0.7.0.tar.xz">duktape-full-0.7.0.tar.xz</a></td><td class="description">(see above)</td><td class="hash">XXX</td></tr>
<tr class="latest"><td class="reldate">2013-12-18</td><td class="filename"><a href="duktape-full-0.8.0.tar.xz">duktape-full-0.8.0.tar.xz</a></td><td class="description">(see above)</td><td class="hash">XXX</td></tr>
</tbody>
</table>

Loading…
Cancel
Save