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.

32 lines
828 B

  1. #!/usr/bin/env python
  2. from __future__ import unicode_literals
  3. import io
  4. import optparse
  5. import re
  6. def main():
  7. parser = optparse.OptionParser(usage='%prog FILE')
  8. options, args = parser.parse_args()
  9. if len(args) != 1:
  10. parser.error('Expected an filename')
  11. with io.open(args[0], encoding='utf-8') as inf:
  12. issue_template_text = inf.read()
  13. # Get the version from youtube_dl/version.py without importing the package
  14. exec(compile(open('youtube_dl/version.py').read(),
  15. 'youtube_dl/version.py', 'exec'))
  16. issue_template_text = re.sub(
  17. r'(?<=\*\*)(?P<version>[0-9\.]+)(?=\*\*)',
  18. __version__,
  19. issue_template_text
  20. )
  21. with io.open(args[0], 'w', encoding='utf-8') as outf:
  22. outf.write(issue_template_text)
  23. if __name__ == '__main__':
  24. main()