venv_path and bin_path
This commit is contained in:
parent
500e4d4530
commit
c6c2a4da74
1 changed files with 8 additions and 5 deletions
|
@ -1,18 +1,21 @@
|
||||||
import os
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from virtualenv import cli_run
|
from virtualenv import cli_run
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
# TODO location
|
# TODO location
|
||||||
if not os.access("/tmp/kiwi/bin/kiwi-core", os.X_OK):
|
venv_path = Path("/") / "tmp" / "kiwi"
|
||||||
cli_run(["/tmp/kiwi"])
|
bin_path = venv_path / "bin"
|
||||||
subprocess.check_call(["/tmp/kiwi/bin/python3", "-m", "pip", "install", "."])
|
|
||||||
|
if not (bin_path / "kiwi-core").exists():
|
||||||
|
cli_run([str(venv_path)])
|
||||||
|
subprocess.check_call([bin_path / "python3", "-m", "pip", "install", "."])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(["/tmp/kiwi/bin/kiwi-core", *sys.argv[1::]])
|
subprocess.check_call([bin_path / "kiwi-core", *sys.argv[1::]])
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
sys.exit(exc.returncode)
|
sys.exit(exc.returncode)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue