Make sure we also add PYTHONPATH from StackStorm package installation
virtualenv to PYTHONPATH for st2-run-pack-tests so it works out of the
box on package based installations.
@@ -49,6 +49,7 @@ VERBOSE=false
VIRTUALENV_ACTIVATED=false
STACKSTORM_VIRTUALENV_BIN="/opt/stackstorm/st2/bin"
+STACKSTORM_VIRTUALENV_PYTHON_BINARY="${STACKSTORM_VIRTUALENV_BIN}/python"
####################
# Script beings here
@@ -228,8 +229,16 @@ if [ "${JUST_TESTS}" = false ]; then
fi
fi
+
+STACKSTORM_VIRTUALENV_PYTHON_BINARY="${STACKSTORM_VIRTUALENV_BIN}/python"
+
# Set PYTHONPATH, make sure it contains st2 components in PATH
+if [ -f "${STACKSTORM_VIRTUALENV_PYTHON_BINARY}" ]; then
+ ST2_PYTHONPATH=$(${STACKSTORM_VIRTUALENV_PYTHON_BINARY} -c "import sys;print ':'.join(sys.path)")
+ export PYTHONPATH="${ST2_PYTHONPATH}:${PYTHONPATH}:${PACK_PYTHONPATH}"
+else
export PYTHONPATH="${PYTHONPATH}:${PACK_PYTHONPATH}"
+fi
verbose_log "PYTHONPATH=${PYTHONPATH}"
verbose_log "PATH=${PATH}"
