Don't use tiamat-pip on Windows until it is fixed

This commit is contained in:
Twangboy 2021-07-23 14:08:04 -06:00 committed by Gareth J. Greenaway
parent 4df4441a7f
commit ad5b8e1783

37
run.py
View file

@ -9,9 +9,13 @@ import sys
import salt.scripts
import salt.utils.platform
import tiamatpip.cli
import tiamatpip.configure
import tiamatpip.utils
# tiamat pip breaks singlebin on Windows at the moment
# https://gitlab.com/saltstack/pop/tiamat-pip/-/issues/4
if not sys.platform.startswith("win"):
import tiamatpip.cli
import tiamatpip.configure
import tiamatpip.utils
AVAIL = (
"minion",
@ -33,10 +37,13 @@ AVAIL = (
)
PIP_PATH = pathlib.Path(f"{os.sep}opt", "saltstack", "salt", "pypath")
with contextlib.suppress(PermissionError):
PIP_PATH.mkdir(mode=0o755, parents=True, exist_ok=True)
tiamatpip.configure.set_user_site_packages_path(PIP_PATH)
# tiamat pip breaks singlebin on Windows at the moment
# https://gitlab.com/saltstack/pop/tiamat-pip/-/issues/4
if not sys.platform.startswith("win"):
PIP_PATH = pathlib.Path(f"{os.sep}opt", "saltstack", "salt", "pypath")
with contextlib.suppress(PermissionError):
PIP_PATH.mkdir(mode=0o755, parents=True, exist_ok=True)
tiamatpip.configure.set_user_site_packages_path(PIP_PATH)
def redirect(argv):
@ -53,9 +60,12 @@ def redirect(argv):
if cmd == "shell":
py_shell()
return
if tiamatpip.cli.should_redirect_argv(argv):
tiamatpip.cli.process_pip_argv(argv)
return
# tiamat pip breaks singlebin on Windows at the moment
# https://gitlab.com/saltstack/pop/tiamat-pip/-/issues/4
if not sys.platform.startswith("win"):
if tiamatpip.cli.should_redirect_argv(argv):
tiamatpip.cli.process_pip_argv(argv)
return
if cmd not in AVAIL:
# Fall back to the salt command
args = ["salt"]
@ -65,8 +75,11 @@ def redirect(argv):
sys.argv.pop(1)
s_fun = getattr(salt.scripts, f"salt_{cmd}")
args.extend(argv[1:])
with tiamatpip.utils.patched_sys_argv(args):
s_fun()
# tiamat pip breaks singlebin on Windows at the moment
# https://gitlab.com/saltstack/pop/tiamat-pip/-/issues/4
if not sys.platform.startswith("win"):
with tiamatpip.utils.patched_sys_argv(args):
s_fun()
def py_shell():