From 182d99ca17da9a52c31d31c76fc7d9e39c5f07f2 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 20 Aug 2023 08:12:07 -0500 Subject: [PATCH] fix: properly handle only deps case --- src/viv/viv.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/viv/viv.py b/src/viv/viv.py index 7389201..62ffc9c 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -56,7 +56,7 @@ from typing import ( from urllib.error import HTTPError from urllib.request import urlopen -__version__ = "23.8b1-dev" +__version__ = "23.8b1-1-geefcabe-dev" class Spinner: @@ -1681,10 +1681,11 @@ class Viv: if viv_used and deps: error( "Script Dependencies block and " - "`viv` API can't be used in the same script" + "`viv.use` API can't be used in the same script" ) if not self.local_source and viv_used: + log.debug("fetching remote copy to use for python api") (tmppath / "viv.py").write_text( fetch_script( "https://raw.githubusercontent.com/daylinmorgan/viv/latest/src/viv/viv.py" @@ -1699,9 +1700,8 @@ class Viv: if viv_used: env.update({"VIV_SPEC": " ".join(f"'{req}'" for req in spec)}) - subprocess_run_quit([sys.executable, scriptpath, *rest], env=env) - elif not spec: + elif not spec and not deps: log.warning("using viv with empty spec, skipping vivenv creation") subprocess_run_quit([sys.executable, scriptpath, *rest]) else: @@ -1712,7 +1712,6 @@ class Viv: vivenv.touch() vivenv.meta.write() - subprocess_run_quit([vivenv.python, scriptpath, *rest]) def cmd_run(