mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 02:30:44 -06:00
fix: standalone should also use shortened name
This commit is contained in:
parent
044a22901b
commit
0cc9faa221
2 changed files with 14 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# AUTOGENERATED by viv (v23.8a1-5-g4c782db-dev)
|
||||
# AUTOGENERATED by viv (v23.8b2-6-gdafa099-dev)
|
||||
# see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help`
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ def _viv_use(*pkgs, track_exe=False, name=""):
|
|||
(cache := (base) / "viv/venvs").mkdir(parents=True, exist_ok=True)
|
||||
exe = str(Path(sys.executable).resolve()) if track_exe else "N/A"
|
||||
_id = hashlib.sha256((str(spec := [*pkgs]) + exe).encode()).hexdigest()
|
||||
if (env := cache / (name if name else _id)) not in cache.glob("*/") or F:
|
||||
if (env := cache / (name if name else _id[:8])) not in cache.glob("*/") or F:
|
||||
sys.stderr.write(f"generating new vivenv -> {env.name}\n")
|
||||
venv.create(env, prompt=f"viv-{name}", symlinks=True, clear=True)
|
||||
kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if V else (-1, 2))))
|
||||
|
@ -49,7 +49,7 @@ import sys
|
|||
if __name__ == "__main__":
|
||||
vivenv = _viv_use(
|
||||
"black==23.7.0",
|
||||
"click==8.1.6",
|
||||
"click==8.1.7",
|
||||
"mypy-extensions==1.0.0",
|
||||
"packaging==23.1", # noqa
|
||||
"pathspec==0.11.2",
|
||||
|
|
|
@ -52,7 +52,7 @@ from typing import (
|
|||
Union,
|
||||
)
|
||||
|
||||
__version__ = "23.8b2-6-gdafa099-dev"
|
||||
__version__ = "23.8b2-9-g044a229-dev"
|
||||
|
||||
|
||||
class Spinner:
|
||||
|
@ -357,7 +357,7 @@ class Template:
|
|||
(cache := (base) / "viv/venvs").mkdir(parents=True, exist_ok=True)
|
||||
exe = str(Path(sys.executable).resolve()) if track_exe else "N/A"
|
||||
_id = hashlib.sha256((str(spec := [*pkgs]) + exe).encode()).hexdigest()
|
||||
if (env := cache / (name if name else _id)) not in cache.glob("*/") or F:
|
||||
if (env := cache / (name if name else _id[:8])) not in cache.glob("*/") or F:
|
||||
sys.stderr.write(f"generating new vivenv -> {env.name}\n")
|
||||
venv.create(env, prompt=f"viv-{name}", symlinks=True, clear=True)
|
||||
kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if V else (-1, 2))))
|
||||
|
@ -1124,13 +1124,19 @@ def resolve_deps(reqs: List[str], requirements: Path) -> List[str]:
|
|||
"--dry-run",
|
||||
"--quiet",
|
||||
"--ignore-installed",
|
||||
"--disable-pip-version-check",
|
||||
"--report",
|
||||
"-",
|
||||
] + spec
|
||||
|
||||
report = json.loads(
|
||||
subprocess_run(cmd, check_output=True, spinmsg="resolving depedencies")
|
||||
try:
|
||||
result = subprocess_run(cmd, check_output=True, spinmsg="resolving depedencies")
|
||||
report = json.loads(result)
|
||||
except json.JSONDecodeError:
|
||||
err_quit(
|
||||
f"failed to parse result from cmd: {a.bold}{' '.join(cmd)}{a.end}\n"
|
||||
"see viv log for output"
|
||||
)
|
||||
|
||||
resolved_spec = [
|
||||
f"{pkg['metadata']['name']}=={pkg['metadata']['version']}"
|
||||
for pkg in report["install"]
|
||||
|
|
Loading…
Reference in a new issue