]> jfr.im git - yt-dlp.git/blob - devscripts/make_issue_template.py
[cleanup] Consistent style for file heads
[yt-dlp.git] / devscripts / make_issue_template.py
1 #!/usr/bin/env python3
2
3 # Allow direct execution
4 import os
5 import sys
6
7 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
9
10 import optparse
11
12
13 def read(fname):
14 with open(fname, encoding='utf-8') as f:
15 return f.read()
16
17
18 # Get the version without importing the package
19 def read_version(fname):
20 exec(compile(read(fname), fname, 'exec'))
21 return locals()['__version__']
22
23
24 def main():
25 parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
26 options, args = parser.parse_args()
27 if len(args) != 2:
28 parser.error('Expected an input and an output filename')
29
30 infile, outfile = args
31 with open(outfile, 'w', encoding='utf-8') as outf:
32 outf.write(
33 read(infile) % {'version': read_version('yt_dlp/version.py')})
34
35
36 if __name__ == '__main__':
37 main()