kiwi-scp/kiwi/src/kiwi_scp/main.py

24 lines
572 B
Python

import subprocess
import sys
from pathlib import Path
from virtualenv import cli_run
def main() -> None:
# TODO location
venv_path = Path("/") / "tmp" / "kiwi"
bin_path = venv_path / "bin"
if not (bin_path / "kiwi-core").exists():
cli_run([str(venv_path)])
subprocess.check_call([bin_path / "python3", "-m", "pip", "install", "."])
try:
subprocess.check_call([bin_path / "kiwi-core", *sys.argv[1::]])
except subprocess.CalledProcessError as exc:
sys.exit(exc.returncode)
if __name__ == "__main__":
main()