import argparse
import functools
+import subprocess
def read_file(fname):
return f.write(content)
-# Get the version without importing the package
def read_version(fname='yt_dlp/version.py'):
+ """Get the version without importing the package"""
exec(compile(read_file(fname), fname, 'exec'))
return locals()['__version__']
def compose_functions(*functions):
return lambda x: functools.reduce(lambda y, f: f(y), functions, x)
+
+
+def run_process(*args, **kwargs):
+ kwargs.setdefault('text', True)
+ kwargs.setdefault('check', True)
+ kwargs.setdefault('capture_output', True)
+ if kwargs['text']:
+ kwargs.setdefault('encoding', 'utf-8')
+ kwargs.setdefault('errors', 'replace')
+ return subprocess.run(args, **kwargs)