]> jfr.im git - yt-dlp.git/blame - devscripts/make_issue_template.py
Add ISSUE_TEMPLATE.tmpl as template for ISSUE_TEMPLATE.md
[yt-dlp.git] / devscripts / make_issue_template.py
CommitLineData
7710bdf4
SO
1#!/usr/bin/env python
2from __future__ import unicode_literals
3
4import io
5import optparse
6import re
7
8
9def 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
31if __name__ == '__main__':
32 main()