]>
Commit | Line | Data |
---|---|---|
067f6a35 FV |
1 | #!/usr/bin/env python3 |
2 | import hashlib | |
067f6a35 | 3 | import urllib.request |
b962b76f | 4 | import json |
067f6a35 | 5 | |
b962b76f FV |
6 | versions_info = json.load(open('update/versions.json')) |
7 | version = versions_info['latest'] | |
8 | URL = versions_info['versions'][version]['bin'][0] | |
067f6a35 | 9 | |
b962b76f | 10 | data = urllib.request.urlopen(URL).read() |
067f6a35 FV |
11 | |
12 | # Read template page | |
13 | with open('download.html.in', 'r', encoding='utf-8') as tmplf: | |
14 | template = tmplf.read() | |
15 | ||
16 | md5sum = hashlib.md5(data).hexdigest() | |
17 | sha1sum = hashlib.sha1(data).hexdigest() | |
18 | sha256sum = hashlib.sha256(data).hexdigest() | |
19 | template = template.replace('@PROGRAM_VERSION@', version) | |
20 | template = template.replace('@PROGRAM_URL@', URL) | |
21 | template = template.replace('@PROGRAM_MD5SUM@', md5sum) | |
22 | template = template.replace('@PROGRAM_SHA1SUM@', sha1sum) | |
23 | template = template.replace('@PROGRAM_SHA256SUM@', sha256sum) | |
b962b76f FV |
24 | template = template.replace('@EXE_URL@', versions_info['versions'][version]['exe'][0]) |
25 | template = template.replace('@EXE_SHA256SUM@', versions_info['versions'][version]['exe'][1]) | |
26 | template = template.replace('@TAR_URL@', versions_info['versions'][version]['tar'][0]) | |
27 | template = template.replace('@TAR_SHA256SUM@', versions_info['versions'][version]['tar'][1]) | |
067f6a35 FV |
28 | with open('download.html', 'w', encoding='utf-8') as dlf: |
29 | dlf.write(template) |