]> jfr.im git - yt-dlp.git/blob - devscripts/make_issue_template.py
Add initial ISSUE_TEMPLATE
[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 import re
7
8
9 def main():
10 parser = optparse.OptionParser(usage='%prog FILE')
11 options, args = parser.parse_args()
12 if len(args) != 1:
13 parser.error('Expected an filename')
14
15 with io.open(args[0], encoding='utf-8') as inf:
16 issue_template_text = inf.read()
17
18 # Get the version from youtube_dl/version.py without importing the package
19 exec(compile(open('youtube_dl/version.py').read(),
20 'youtube_dl/version.py', 'exec'))
21
22 issue_template_text = re.sub(
23 r'(?<=\*\*)(?P<version>[0-9\.]+)(?=\*\*)',
24 __version__,
25 issue_template_text
26 )
27
28 with io.open(args[0], 'w', encoding='utf-8') as outf:
29 outf.write(issue_template_text)
30
31 if __name__ == '__main__':
32 main()