fix: don't use local-source that doesn't exist

This commit is contained in:
Daylin Morgan 2023-05-28 10:10:59 -05:00
parent e68f5a3ba1
commit 49164f8b1b
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -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"""