Updated CLI bootstrap to search for local virtualenv installations. A locally installed virtualenv does not always show up on the `PATH`, which fails `which virtualenv`. This adds an extra search location based on the user's site package install directory.
Review: https://reviews.apache.org/r/52707/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9588a600 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9588a600 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9588a600 Branch: refs/heads/master Commit: 9588a6009e956ec1629be13df6a41dc98dd0180d Parents: 8c8ec60 Author: Joseph Wu <jos...@mesosphere.io> Authored: Wed Oct 12 13:17:56 2016 -0700 Committer: Joseph Wu <josep...@apache.org> Committed: Wed Oct 12 14:41:30 2016 -0700 ---------------------------------------------------------------------- src/cli_new/bootstrap | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/9588a600/src/cli_new/bootstrap ---------------------------------------------------------------------- diff --git a/src/cli_new/bootstrap b/src/cli_new/bootstrap index 74a8568..6d62e9a 100755 --- a/src/cli_new/bootstrap +++ b/src/cli_new/bootstrap @@ -29,11 +29,22 @@ if [ "${OLD_VIRTUAL_ENV}" != "" ]; then fi # Verify that python and virtualenv are installed. -if [ "${PYTHON}" = "" ] || [ "${VIRTUALENV}" = "" ]; then - echo "You must have python and virtualenv installed in order to continue..." +if [ "${PYTHON}" = "" ]; then + echo "You must have python installed in order to continue..." exit 1 fi +if [ "${VIRTUALENV}" = "" ]; then + # Search for a locally installed virtualenv. + # See https://docs.python.org/2/library/site.html#site.USER_SITE for details. + VIRTUALENV=$(${PYTHON} -c "import site; print site.USER_SITE")/virtualenv.py + + if [ ! -f "${VIRTUALENV}" ]; then + echo "You must have virtualenv installed in order to continue..." + exit 1 + fi +fi + PYTHON_MAJOR=$(${PYTHON} -c 'import sys; print(sys.version_info[0])') PYTHON_MINOR=$(${PYTHON} -c 'import sys; print(sys.version_info[1])')