mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Re-enable tiamat-pip on windows
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
b398065003
commit
76efef6e86
1 changed files with 24 additions and 35 deletions
59
run.py
59
run.py
|
@ -9,13 +9,9 @@ import sys
|
|||
|
||||
import salt.scripts
|
||||
import salt.utils.platform
|
||||
|
||||
# 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
|
||||
import tiamatpip.cli
|
||||
import tiamatpip.configure
|
||||
import tiamatpip.utils
|
||||
|
||||
AVAIL = (
|
||||
"minion",
|
||||
|
@ -37,13 +33,25 @@ AVAIL = (
|
|||
)
|
||||
|
||||
|
||||
# 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_base_path(PIP_PATH)
|
||||
else:
|
||||
PIP_PATH = pathlib.Path(os.getenv("LocalAppData"), "salt", "pypath")
|
||||
with contextlib.suppress(PermissionError):
|
||||
PIP_PATH.mkdir(mode=0o755, parents=True, exist_ok=True)
|
||||
tiamatpip.configure.set_user_base_path(PIP_PATH)
|
||||
|
||||
|
||||
def py_shell():
|
||||
if not sys.platform.startswith("win"):
|
||||
# optional, will allow Up/Down/History in the console
|
||||
import readline
|
||||
import code
|
||||
|
||||
variables = globals().copy()
|
||||
variables.update(locals())
|
||||
shell = code.InteractiveConsole(variables)
|
||||
shell.interact()
|
||||
|
||||
|
||||
def redirect(argv):
|
||||
|
@ -60,12 +68,9 @@ def redirect(argv):
|
|||
if cmd == "shell":
|
||||
py_shell()
|
||||
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 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"]
|
||||
|
@ -75,26 +80,10 @@ def redirect(argv):
|
|||
sys.argv.pop(1)
|
||||
s_fun = getattr(salt.scripts, f"salt_{cmd}")
|
||||
args.extend(argv[1:])
|
||||
# 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()
|
||||
else:
|
||||
with tiamatpip.utils.patched_sys_argv(args):
|
||||
s_fun()
|
||||
|
||||
|
||||
def py_shell():
|
||||
if not sys.platform.startswith("win"):
|
||||
import readline # optional, will allow Up/Down/History in the console
|
||||
import code
|
||||
|
||||
variables = globals().copy()
|
||||
variables.update(locals())
|
||||
shell = code.InteractiveConsole(variables)
|
||||
shell.interact()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if sys.platform.startswith("win"):
|
||||
multiprocessing.freeze_support()
|
||||
|
|
Loading…
Add table
Reference in a new issue