3 # Allow direct execution
7 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
14 with open(fname
, encoding
='utf-8') as f
:
18 # Get the version without importing the package
19 def read_version(fname
):
20 exec(compile(read(fname
), fname
, 'exec'))
21 return locals()['__version__']
25 parser
= optparse
.OptionParser(usage
='%prog INFILE OUTFILE')
26 options
, args
= parser
.parse_args()
28 parser
.error('Expected an input and an output filename')
30 infile
, outfile
= args
31 with open(outfile
, 'w', encoding
='utf-8') as outf
:
33 read(infile
) % {'version': read_version('yt_dlp/version.py')}
)
36 if __name__
== '__main__':