56589cd8af44fd877d9907ae615d8b1f3e88b5ea

Author
Adam Horacek <adam.horacek@sap.com>
Committer
Adam Horacek <adam.horacek@sap.com>
Date

Message

check python if AUTOSWITCH_DEFAULT_PYTHON is set

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index c4f858259b2bfccb48a7f0f795f69f0c04b1e07c..eb50fd7b1e4574538d97f7bca4fff72c64a6f23b 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -284,7 +284,7 @@ function _missing_error_message() {
 6 
 7 function randstr()
 8 {
 9-    python -c "from __future__ import print_function; import string, random; print(''.join(random.choice(string.ascii_lowercase) for _ in range(4)))"
10+    ${AUTOSWITCH_DEFAULT_PYTHON:-python} -c "from __future__ import print_function; import string, random; print(''.join(random.choice(string.ascii_lowercase) for _ in range(4)))"
11 }
12 
13 
14@@ -413,7 +413,7 @@ function _autoswitch_startup() {
15     check_venv
16 }
17 
18-if ! type "python" > /dev/null; then
19+if ! type "${AUTOSWITCH_DEFAULT_PYTHON:-python}" > /dev/null; then
20     printf "WARNING: python binary not found on PATH.\n"
21     printf "zsh-autoswitch-virtualenv plugin will be disabled.\n"
22 else