|
|
@ -25,10 +25,11 @@
|
|
|
|
from __future__ import annotations
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
|
|
from functools import cached_property, wraps
|
|
|
|
from functools import cache, cached_property, wraps
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
import shlex
|
|
|
|
import shlex
|
|
|
|
|
|
|
|
from subprocess import CompletedProcess, PIPE, run
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
from typing import (
|
|
|
|
from typing import (
|
|
|
|
Dict,
|
|
|
|
Dict,
|
|
|
@ -131,6 +132,18 @@ def combine_cmds(*commands: CommandArgs | List[Optional[str]]) -> CommandArgs:
|
|
|
|
return CommandArgs([arg for cmd in commands for arg in filter_cmds(cmd)])
|
|
|
|
return CommandArgs([arg for cmd in commands for arg in filter_cmds(cmd)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def exec_cmd(
|
|
|
|
|
|
|
|
command: CommandArgs, check: bool = True, capture_stdout: bool = True
|
|
|
|
|
|
|
|
) -> CompletedProcess:
|
|
|
|
|
|
|
|
res = run(
|
|
|
|
|
|
|
|
args=command,
|
|
|
|
|
|
|
|
check=check,
|
|
|
|
|
|
|
|
shell=False,
|
|
|
|
|
|
|
|
stdout=PIPE if capture_stdout else None,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@wraps(print)
|
|
|
|
@wraps(print)
|
|
|
|
def error(*args, **kwargs):
|
|
|
|
def error(*args, **kwargs):
|
|
|
|
ret = print(*args, file=sys.stderr, **kwargs)
|
|
|
|
ret = print(*args, file=sys.stderr, **kwargs)
|
|
|
|