generate-download.py 952 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python3
  2. from __future__ import unicode_literals
  3. import json
  4. import os.path
  5. import sys
  6. dirn = os.path.dirname
  7. sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
  8. from utils import read_file, write_file
  9. versions_info = json.loads(read_file('update/versions.json'))
  10. version = versions_info['latest']
  11. version_dict = versions_info['versions'][version]
  12. # Read template page
  13. template = read_file('download.html.in')
  14. template = template.replace('@PROGRAM_VERSION@', version)
  15. template = template.replace('@PROGRAM_URL@', version_dict['bin'][0])
  16. template = template.replace('@PROGRAM_SHA256SUM@', version_dict['bin'][1])
  17. template = template.replace('@EXE_URL@', version_dict['exe'][0])
  18. template = template.replace('@EXE_SHA256SUM@', version_dict['exe'][1])
  19. template = template.replace('@TAR_URL@', version_dict['tar'][0])
  20. template = template.replace('@TAR_SHA256SUM@', version_dict['tar'][1])
  21. write_file('download.html', template)