]>
Commit | Line | Data |
---|---|---|
cc52de43 | 1 | #!/usr/bin/env python3 |
7710bdf4 | 2 | import optparse |
7710bdf4 SO |
3 | |
4 | ||
c1714454 | 5 | def 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 | |
11 | def read_version(fname): | |
12 | exec(compile(read(fname), fname, 'exec')) | |
13 | return locals()['__version__'] | |
14 | ||
15 | ||
7710bdf4 | 16 | def 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 |
28 | if __name__ == '__main__': |
29 | main() |