Add windows support to _verify_virtualenv function in salt.modules.virtualenv_mod

This commit is contained in:
Pedro Algarvio 2024-04-11 16:51:42 +01:00
parent 3a774bd92d
commit 4098a29c8e

View file

@ -501,11 +501,13 @@ def _verify_safe_py_code(*args):
def _verify_virtualenv(venv_path):
bin_path = os.path.join(venv_path, "bin/python")
if salt.utils.platform.is_windows():
bin_path = os.path.join(venv_path, "Scripts", "python.exe")
else:
bin_path = os.path.join(venv_path, "bin", "python")
if not os.path.exists(bin_path):
raise CommandExecutionError(
"Path '{}' does not appear to be a virtualenv: bin/python not found.".format(
venv_path
)
f"Path '{venv_path}' does not appear to be a virtualenv: '{bin_path}' not found."
)
return bin_path