fix: don't use none type

This commit is contained in:
Daylin Morgan 2023-06-02 13:14:04 -05:00
parent ccccbbb147
commit f069eafb11
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
2 changed files with 13 additions and 6 deletions

View file

@ -1,4 +1,8 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# AUTOGENERATED by viv (v23.5a4-37-gf8ebd9d-dev)
# see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help`
def _viv_use(*pkgs, track_exe=False, name=""):
import hashlib, json, os, site, shutil, sys, venv # noqa
from pathlib import Path # noqa
@ -18,7 +22,7 @@ def _viv_use(*pkgs, track_exe=False, name=""):
_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, with_pip=True, clear=True).create(env)
venv.create(env, symlinks=True, with_pip=True, clear=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))))
p = run([env / "bin" / "pip", "install", "--force-reinstall", *spec], **run_kw)

View file

@ -51,7 +51,7 @@ from typing import (
from urllib.error import HTTPError
from urllib.request import urlopen
__version__ = "23.5a4-37-gf8ebd9d-dev"
__version__ = "23.5a4-40-gccccbbb-dev"
class Spinner:
@ -222,7 +222,7 @@ to create/activate a vivenv:
_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, with_pip=True, clear=True).create(env)
venv.create(env, symlinks=True, with_pip=True, clear=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))))
p = run([env / "bin" / "pip", "install", "--force-reinstall", *spec], **run_kw)
@ -258,8 +258,8 @@ to create/activate a vivenv:
(self._standalone_func, self.noqa(self._use_str(spec, standalone=True)))
)
return f"""
# see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help`
# AUTOGENERATED by viv (v{__version__})
# see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help`
{func_use}
"""
@ -313,7 +313,10 @@ to create/activate a vivenv:
else:
imports = ""
return f"""\
#!/usr/bin/env python3
#!/usr/bin/env python
# AUTOGENERATED by viv (v{__version__})
# see `python3 <(curl -fsSL viv.dayl.in/viv.py) --help`
{imports}
import subprocess
import sys