mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-13 20:47:53 -06:00
docs: update README example
This commit is contained in:
parent
f646278f8b
commit
834cd449bd
2 changed files with 3 additions and 7 deletions
|
@ -81,16 +81,13 @@ def _viv_activate(*pkgs: str, track_exe: bool = False, name: str = "") -> None:
|
|||
p = run([envpath/"bin"/"pip","install","--force-reinstall", *spec], universal_newlines=True, # noqa
|
||||
**dict(zip(("stdout","stderr"),[(-1,-2),(None,)*2,][e(ge("VIV_VERBOSE"))]))) # noqa
|
||||
if (p.returncode!=0)*envpath.is_dir():i("shutil").rmtree(str(envpath)) # noqa
|
||||
if p.returncode!=0:sys.stderr.write(f"pip had non zero exit ({p.returncode})\\n{p.stdout}");sys.exit(p.returncode) # noqa
|
||||
if p.returncode!=0:sys.stderr.write(f"pip had non zero exit ({p.returncode})\n{p.stdout}");sys.exit(p.returncode) # noqa
|
||||
with (envpath/"viv-info.json").open("w") as f: # noqa
|
||||
i("json").dump({"created":str(i("datetime").datetime.today()),"id":_id,"spec":spec,"exe":exe},f) # noqa
|
||||
sys.path = [p for p in (*sys.path, str(*(envpath/"lib").glob("py*/si*"))) if p!=i("site").USER_SITE] # noqa
|
||||
|
||||
_viv_activate("markdown-it-py==2.2.0", "mdurl==0.1.2", "Pygments==2.14.0", "rich==13.3.2") # noqa
|
||||
|
||||
_viv_activate("markdown-it-py==2.2.0", "mdurl==0.1.2", "Pygments==2.14.0", "rich==13.3.2")
|
||||
# fmt: on
|
||||
# >>>>> code golfed with <3
|
||||
|
||||
```
|
||||
|
||||
## Alternatives
|
||||
|
|
|
@ -503,12 +503,11 @@ def _viv_activate(*pkgs: str, track_exe: bool = False, name: str = "") -> None:
|
|||
p = run([envpath/"bin"/"pip","install","--force-reinstall", *spec], universal_newlines=True,
|
||||
**dict(zip(("stdout","stderr"),[(-1,-2),(None,)*2,][e(ge("VIV_VERBOSE"))])))
|
||||
if (p.returncode!=0)*envpath.is_dir():i("shutil").rmtree(str(envpath))
|
||||
if p.returncode!=0:sys.stderr.write(f"pip had non zero exit ({{p.returncode}})\\n{{p.stdout}}");sys.exit(p.returncode)
|
||||
if p.returncode!=0:sys.stderr.write(f"pip had non zero exit ({{p.returncode}})\n{{p.stdout}}");sys.exit(p.returncode)
|
||||
with (envpath/"viv-info.json").open("w") as f:
|
||||
i("json").dump({{"created":str(i("datetime").datetime.today()),"id":_id,"spec":spec,"exe":exe}},f)
|
||||
sys.path = [p for p in (*sys.path, str(*(envpath/"lib").glob("py*/si*"))) if p!=i("site").USER_SITE]
|
||||
_viv_activate({spec})
|
||||
|
||||
""".splitlines()[ # noqa
|
||||
1:
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue