You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
985 B

  1. #!/usr/bin/env python
  2. import hashlib
  3. import subprocess
  4. import sys
  5. # Run command line and get output
  6. def output(cmdline):
  7. p = subprocess.Popen(cmdline, shell=True, stdout=subprocess.PIPE)
  8. retval = p.communicate()[0]
  9. p.wait()
  10. return retval
  11. # Read template page
  12. template = file('index.html.in', 'r').read()
  13. # Build replacement strings
  14. version = output('cd ../master && git tag | tail -1').strip()
  15. data = output('cd ../master && git show %s:youtube-dl' % version)
  16. url = 'http://github.com/rg3/youtube-dl/raw/%s/youtube-dl' % version
  17. md5sum = hashlib.md5(data).hexdigest()
  18. sha1sum = hashlib.sha1(data).hexdigest()
  19. sha256sum = hashlib.sha256(data).hexdigest()
  20. template = template.replace('@PROGRAM_VERSION@', version)
  21. template = template.replace('@PROGRAM_URL@', url)
  22. template = template.replace('@PROGRAM_MD5SUM@', md5sum)
  23. template = template.replace('@PROGRAM_SHA1SUM@', sha1sum)
  24. template = template.replace('@PROGRAM_SHA256SUM@', sha256sum)
  25. file('index.html', 'w').write(template)