fix: use prompt in standalone venvs

This commit is contained in:
Daylin Morgan 2023-08-03 18:31:56 -05:00
parent b08eeb1c71
commit ae30ff2b84
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.5a7"
__version__ = "23.5a7-1-g86f4773-dev"
class Spinner:
@ -347,7 +347,7 @@ class Template:
_id = sha256.hexdigest()
if (env := cache / (name if name else _id)) not in cache.glob("*/") or force:
sys.stderr.write(f"generating new vivenv -> {env.name}\n")
venv.create(env, symlinks=True, clear=True)
venv.create(env, prompt=f"viv-{name}", symlinks=True, clear=True)
kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if verbose else (-1, 2))))
cmd = ["pip", "--python", str(env / "bin" / "python"), "install", *spec]
p = run(cmd, **kw)
@ -362,8 +362,8 @@ class Template:
meta.update(dict(accessed=t, files=sorted({*meta["files"], runner})))
(env / "vivmeta.json").write_text(json.dumps(meta))
site.addsitedir(sitepkgs:=str(*(env / "lib").glob("py*/si*")))
sys.path = [p for p in (sitepkgs,*sys.path) if p != site.USER_SITE]
site.addsitedir(sitepkgs := str(*(env / "lib").glob("py*/si*")))
sys.path = [p for p in (sitepkgs, *sys.path) if p != site.USER_SITE]
return env
"""