make_issue_template.py 807 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. from __future__ import unicode_literals
  3. import io
  4. import optparse
  5. def main():
  6. parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
  7. options, args = parser.parse_args()
  8. if len(args) != 2:
  9. parser.error('Expected an input and an output filename')
  10. infile, outfile = args
  11. with io.open(infile, encoding='utf-8') as inf:
  12. issue_template_tmpl = inf.read()
  13. __version__ = None
  14. # Get the version from youtube_dl/version.py without importing the package
  15. exec(compile(open('youtube_dl/version.py').read(),
  16. 'youtube_dl/version.py', 'exec'))
  17. out = issue_template_tmpl % {'version': __version__}
  18. with io.open(outfile, 'w', encoding='utf-8') as outf:
  19. outf.write(out)
  20. if __name__ == '__main__':
  21. main()