mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-09 19:13:14 -06:00
fix: catch file not found error
This commit is contained in:
parent
7da6cc79f0
commit
6e6fb99d1c
1 changed files with 19 additions and 1 deletions
|
@ -52,7 +52,7 @@ from typing import (
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
__version__ = "23.5a7-1-gae30ff2-dev"
|
__version__ = "23.5a7-2-g7da6cc7-dev"
|
||||||
|
|
||||||
|
|
||||||
class Spinner:
|
class Spinner:
|
||||||
|
@ -840,6 +840,22 @@ class ViVenv:
|
||||||
|
|
||||||
return sorted(spec)
|
return sorted(spec)
|
||||||
|
|
||||||
|
def bin_exists(self, bin: str) -> None:
|
||||||
|
if not (self.path / "bin" / bin).is_file():
|
||||||
|
message = (
|
||||||
|
f"{a.bold}{bin}{a.end} does not exist, "
|
||||||
|
"use -b/--bin to specify an entrypoint"
|
||||||
|
"\nOptions:\n"
|
||||||
|
)
|
||||||
|
message += "\t" + " ".join(
|
||||||
|
(
|
||||||
|
a.style(p.name, "bold")
|
||||||
|
for p in (self.path / "bin").iterdir()
|
||||||
|
if not p.name.lower().startswith("activate")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
err_quit(message)
|
||||||
|
|
||||||
def create(self, quiet: bool = False) -> None:
|
def create(self, quiet: bool = False) -> None:
|
||||||
log.info(f"new unique vivenv: {a.bold}{self.name}{a.end}")
|
log.info(f"new unique vivenv: {a.bold}{self.name}{a.end}")
|
||||||
log.debug(f"creating new venv at {self.path}")
|
log.debug(f"creating new venv at {self.path}")
|
||||||
|
@ -1499,6 +1515,7 @@ class Viv:
|
||||||
vivenv.set_path(Path(tmpdir))
|
vivenv.set_path(Path(tmpdir))
|
||||||
vivenv.create()
|
vivenv.create()
|
||||||
vivenv.install_pkgs()
|
vivenv.install_pkgs()
|
||||||
|
vivenv.bin_exists(bin)
|
||||||
sys.exit(
|
sys.exit(
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[vivenv.path / "bin" / bin, *rest]
|
[vivenv.path / "bin" / bin, *rest]
|
||||||
|
@ -1509,6 +1526,7 @@ class Viv:
|
||||||
vivenv.install_pkgs()
|
vivenv.install_pkgs()
|
||||||
vivenv.touch()
|
vivenv.touch()
|
||||||
vivenv.meta.write()
|
vivenv.meta.write()
|
||||||
|
vivenv.bin_exists(bin)
|
||||||
sys.exit(
|
sys.exit(
|
||||||
subprocess.run([vivenv.path / "bin" / bin, *rest]).returncode
|
subprocess.run([vivenv.path / "bin" / bin, *rest]).returncode
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue