refactor: update deps instead of writing to pip.conf

This commit is contained in:
Daylin Morgan 2023-06-03 13:06:46 -05:00
parent 2bc247673e
commit 6e173b2383
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
2 changed files with 6 additions and 11 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
# AUTOGENERATED by viv (v23.5a5-1-g853e6e6-dev) # AUTOGENERATED by viv (v23.5a5-2-ge70afb3-dev)
# see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help` # see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help`
@ -22,8 +22,7 @@ def _viv_use(*pkgs, track_exe=False, name=""):
_id = sha256.hexdigest() _id = sha256.hexdigest()
if (env := cache / (name if name else _id)) not in cache.glob("*/") or force: if (env := cache / (name if name else _id)) not in cache.glob("*/") or force:
sys.stderr.write(f"generating new vivenv -> {env.name}\n") sys.stderr.write(f"generating new vivenv -> {env.name}\n")
venv.create(env, symlinks=True, with_pip=True, clear=True) venv.create(env, symlinks=True, with_pip=True, clear=True, upgrade_deps=True)
(env / "pip.conf").write_text("[global]\ndisable-pip-version-check=true")
run_kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if verbose else (-1, 2)))) run_kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if verbose else (-1, 2))))
p = run([env / "bin" / "pip", "install", "--force-reinstall", *spec], **run_kw) p = run([env / "bin" / "pip", "install", "--force-reinstall", *spec], **run_kw)
if (rc := p.returncode) != 0: if (rc := p.returncode) != 0:

View file

@ -50,7 +50,7 @@ from typing import (
from urllib.error import HTTPError from urllib.error import HTTPError
from urllib.request import urlopen from urllib.request import urlopen
__version__ = "23.5a5-2-ge70afb3-dev" __version__ = "23.5a5-3-g2bc2476-dev"
class Spinner: class Spinner:
@ -221,8 +221,7 @@ to create/activate a vivenv:
_id = sha256.hexdigest() _id = sha256.hexdigest()
if (env := cache / (name if name else _id)) not in cache.glob("*/") or force: if (env := cache / (name if name else _id)) not in cache.glob("*/") or force:
sys.stderr.write(f"generating new vivenv -> {env.name}\n") sys.stderr.write(f"generating new vivenv -> {env.name}\n")
venv.create(env, symlinks=True, with_pip=True, clear=True) venv.create(env, symlinks=True, with_pip=True, clear=True, upgrade_deps=True)
(env / "pip.conf").write_text("[global]\ndisable-pip-version-check=true")
run_kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if verbose else (-1, 2)))) run_kw = dict(zip(("stdout", "stderr"), ((None,) * 2 if verbose else (-1, 2))))
p = run([env / "bin" / "pip", "install", "--force-reinstall", *spec], **run_kw) p = run([env / "bin" / "pip", "install", "--force-reinstall", *spec], **run_kw)
if (rc := p.returncode) != 0: if (rc := p.returncode) != 0:
@ -697,11 +696,8 @@ class ViVenv:
if not quiet: if not quiet:
echo(f"new unique vivenv -> {self.name}") echo(f"new unique vivenv -> {self.name}")
with Spinner("creating vivenv"): with Spinner("creating vivenv"):
venv.create(self.path, with_pip=True, clear=True, symlinks=True) venv.create(
self.path, with_pip=True, clear=True, symlinks=True, upgrade_deps=True
# add config to ignore pip version
(self.path / "pip.conf").write_text(
"[global]\ndisable-pip-version-check = true"
) )
self.meta.created = str(datetime.today()) self.meta.created = str(datetime.today())