]> jfr.im git - yt-dlp.git/blob - devscripts/make_issue_template.py
[devscripts/make_issue_template] Fix NameError under python3
[yt-dlp.git] / devscripts / make_issue_template.py
1 #!/usr/bin/env python
2 from __future__ import unicode_literals
3
4 import io
5 import optparse
6
7
8 def main():
9 parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
10 options, args = parser.parse_args()
11 if len(args) != 2:
12 parser.error('Expected an input and an output filename')
13
14 infile, outfile = args
15
16 with io.open(infile, encoding='utf-8') as inf:
17 issue_template_tmpl = inf.read()
18
19 __version__ = None
20
21 # Get the version from youtube_dl/version.py without importing the package
22 exec(compile(open('youtube_dl/version.py').read(),
23 'youtube_dl/version.py', 'exec'))
24
25 out = issue_template_tmpl % {'version': __version__}
26
27 with io.open(outfile, 'w', encoding='utf-8') as outf:
28 outf.write(out)
29
30 if __name__ == '__main__':
31 main()