refactor: add PYTHONPATH to manage show --system for debugging

This commit is contained in:
Daylin Morgan 2024-01-09 02:17:10 -06:00
parent 9d237d3b96
commit 0e5ac7c9c9
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -54,7 +54,7 @@ from typing import (
Union, Union,
) )
__version__ = "2024.1004" __version__ = "2024.1004-dev"
#### START VENDORED TOMLI #### #### START VENDORED TOMLI ####
@ -1805,20 +1805,17 @@ class Env:
class System: class System:
def __init__(self) -> None: def __init__(self) -> None:
self._windows = platform.system() == "Windows" self.is_win = platform.system() == "Windows"
(self.bin_dir, *_) = ("Scripts",) if self._windows else ("bin",) (self.bin_dir, *_) = ("Scripts",) if self.is_win else ("bin",)
def bin(self, exe: str) -> str: def bin(self, exe: str) -> str:
return f"{exe}.exe" if self._windows else exe return f"{exe}.exe" if self.is_win else exe
system = System() system = System()
class Cfg: class Cfg:
def __init__(self) -> None:
self.windows = platform.system() == "Windows"
@property @property
def src(self) -> Path: def src(self) -> Path:
p = Path(Env().xdg_data_home) / "viv" / "viv.py" p = Path(Env().xdg_data_home) / "viv" / "viv.py"
@ -2602,7 +2599,7 @@ class ViVenv:
self.path, self.path,
prompt=f"viv-{self.name}", prompt=f"viv-{self.name}",
clear=True, clear=True,
symlinks=platform.system() != "Windows", symlinks=not system.is_win,
) )
self.meta.created = str(datetime.today()) self.meta.created = str(datetime.today())
@ -3277,6 +3274,7 @@ class Viv:
"Pip": subprocess_run( "Pip": subprocess_run(
["pip", "--version"], check_output=True ["pip", "--version"], check_output=True
).strip(), ).strip(),
"PYTHONPATH": os.getenv("PYTHONPATH", ""),
} }
) )