]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python3 | |
2 | import io | |
3 | import optparse | |
4 | ||
5 | ||
6 | def main(): | |
7 | parser = optparse.OptionParser(usage='%prog INFILE OUTFILE') | |
8 | options, args = parser.parse_args() | |
9 | if len(args) != 2: | |
10 | parser.error('Expected an input and an output filename') | |
11 | ||
12 | infile, outfile = args | |
13 | ||
14 | with open(infile, encoding='utf-8') as inf: | |
15 | issue_template_tmpl = inf.read() | |
16 | ||
17 | # Get the version from yt_dlp/version.py without importing the package | |
18 | exec(compile(open('yt_dlp/version.py').read(), | |
19 | 'yt_dlp/version.py', 'exec')) | |
20 | ||
21 | out = issue_template_tmpl % {'version': locals()['__version__']} | |
22 | ||
23 | with open(outfile, 'w', encoding='utf-8') as outf: | |
24 | outf.write(out) | |
25 | ||
26 | ||
27 | if __name__ == '__main__': | |
28 | main() |