From 49164f8b1b01f4e71a537bf642fb242c1e28c972 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 28 May 2023 10:10:59 -0500 Subject: [PATCH] fix: don't use local-source that doesn't exist --- src/viv/viv.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/viv/viv.py b/src/viv/viv.py index 578db5d..718ebff 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -52,7 +52,7 @@ from typing import ( from urllib.error import HTTPError from urllib.request import urlopen -__version__ = "23.5a1-13-g1717203" +__version__ = "23.5a1-14-gd7717ff" class Config: @@ -919,19 +919,24 @@ class Viv: try: _local_viv = __import__("viv") self.local_source = ( - _local_viv.__file__ if _local_viv.__file__ else "Not Found" + Path(_local_viv.__file__) if _local_viv.__file__ else "Not Found" ) self.local_version = _local_viv.__version__ except ImportError: self.local_source = self.local_version = "Not Found" - self.git = (self.local_source.parent.parent.parent / ".git").is_dir() - def _check_local_source(self, args:Namespace ) -> None: + if self.local_source != "Not Found": + self.git = (self.local_source.parent.parent.parent / ".git").is_dir() + else: + self.git = False + + def _check_local_source(self, args: Namespace) -> None: if self.local_source == "Not Found" and not (args.standalone or args.path): warn( "failed to find local copy of `viv` " "make sure to add it to your PYTHONPATH" ) + def _match_vivenv(self, name_id: str) -> ViVenv: # type: ignore[return] # TODO: improve matching algorithm to favor names over id's matches: List[ViVenv] = [] @@ -1147,7 +1152,6 @@ class Viv: ), ): self._install_local_src(sha256, args.src, args.cli) - def shim(self, args): """generate viv-powered cli apps"""