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