]> jfr.im git - yt-dlp.git/blame - devscripts/make_issue_template.py
[cleanup] Minor fixes (See desc)
[yt-dlp.git] / devscripts / make_issue_template.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
7710bdf4
SO
2import io
3import optparse
7710bdf4
SO
4
5
c1714454 6def read(fname):
7 with open(fname, encoding='utf-8') as f:
8 return f.read()
9
10
11# Get the version from yt_dlp/version.py without importing the package
12def read_version(fname):
13 exec(compile(read(fname), fname, 'exec'))
14 return locals()['__version__']
15
16
7710bdf4 17def main():
3bf1df51 18 parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
7710bdf4 19 options, args = parser.parse_args()
3bf1df51
S
20 if len(args) != 2:
21 parser.error('Expected an input and an output filename')
7710bdf4 22
3bf1df51 23 infile, outfile = args
86e5f3ed 24 with open(outfile, 'w', encoding='utf-8') as outf:
c1714454 25 outf.write(
26 read(infile) % {'version': read_version('yt_dlp/version.py')})
7710bdf4 27
86e5f3ed 28
7710bdf4
SO
29if __name__ == '__main__':
30 main()