Repository: mesos
Updated Branches:
  refs/heads/master 99c73e0c4 -> 3c1a0bce1


Improved documentation regarding the new CLI setup.

Explains how to create the necessary virtual environment from
anywhere and how to set up autocompletion in such case.

Also removes an unnecessary activation of the virtual environment
in `mesos` and `mesos-cli-tests`.

Review: https://reviews.apache.org/r/65585/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3c1a0bce
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3c1a0bce
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3c1a0bce

Branch: refs/heads/master
Commit: 3c1a0bce1b2cb5e4e3c48374e23c683f5f125f68
Parents: 99c73e0
Author: Armand Grillet <agril...@mesosphere.io>
Authored: Thu Apr 12 14:37:10 2018 +0200
Committer: Kevin Klues <klue...@gmail.com>
Committed: Thu Apr 12 14:37:10 2018 +0200

----------------------------------------------------------------------
 src/python/cli_new/README.md           | 31 +++++++++++++++++++++++++++--
 src/python/cli_new/bin/mesos           |  1 -
 src/python/cli_new/bin/mesos-cli-tests |  1 -
 src/python/cli_new/bootstrap           | 27 +++++++++++++++++++------
 4 files changed, 50 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3c1a0bce/src/python/cli_new/README.md
----------------------------------------------------------------------
diff --git a/src/python/cli_new/README.md b/src/python/cli_new/README.md
index 847141d..1569958 100644
--- a/src/python/cli_new/README.md
+++ b/src/python/cli_new/README.md
@@ -32,9 +32,36 @@ when you are done.
     $ source deactivate
 ```
 
-**NOTE:** The virtual environment will also setup bash
-autocomplete for all `mesos` commands.
+You can also run the `bootstrap` script from any directory
+and specify the `VIRTUALENV_DIRECTORY` to set where it
+should be created.
 
+```
+$ VIRTUALENV_DIRECTORY=/.mesos-cli-venv
+$ ${MESOS_DIR}/src/python/cli_new/bootstrap
+
+...
+
+Setup complete!
+
+To begin working, simply activate your virtual environment,
+run the CLI, and then deactivate the virtual environment
+when you are done.
+
+    $ source /.mesos-cli-venv/bin/activate
+    $ source /.mesos-cli-venv/bin/postactivate
+    $ mesos <command> [<args>...]
+    $ source /.mesos-cli-venv/bin/predeactivate
+    $ deactivate
+
+
+The postactivate and predeactivate files set up autocompletion.
+Add the mesos binary parent directory
+${MESOS_DIR}/src/python/cli_new/bin/
+to your path, export it, and source
+${MESOS_DIR}/src/python/cli_new/mesos.bash_completion
+to skip these two steps in the future.
+```
 
 ## Running tests
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3c1a0bce/src/python/cli_new/bin/mesos
----------------------------------------------------------------------
diff --git a/src/python/cli_new/bin/mesos b/src/python/cli_new/bin/mesos
index c5152a2..aac5400 100755
--- a/src/python/cli_new/bin/mesos
+++ b/src/python/cli_new/bin/mesos
@@ -2,5 +2,4 @@
 
 CURRDIR="$(cd "$(dirname "$0")" && pwd)"
 
-source ${CURRDIR}/../activate
 python ${CURRDIR}/main.py "$@"

http://git-wip-us.apache.org/repos/asf/mesos/blob/3c1a0bce/src/python/cli_new/bin/mesos-cli-tests
----------------------------------------------------------------------
diff --git a/src/python/cli_new/bin/mesos-cli-tests 
b/src/python/cli_new/bin/mesos-cli-tests
index 07659e0..9157d49 100755
--- a/src/python/cli_new/bin/mesos-cli-tests
+++ b/src/python/cli_new/bin/mesos-cli-tests
@@ -2,5 +2,4 @@
 
 CURRDIR="$(cd "$(dirname "$0")" && pwd)"
 
-source ${CURRDIR}/../activate
 python ${CURRDIR}/../tests/main.py "$@"

http://git-wip-us.apache.org/repos/asf/mesos/blob/3c1a0bce/src/python/cli_new/bootstrap
----------------------------------------------------------------------
diff --git a/src/python/cli_new/bootstrap b/src/python/cli_new/bootstrap
index 9329a61..b30db50 100755
--- a/src/python/cli_new/bootstrap
+++ b/src/python/cli_new/bootstrap
@@ -94,16 +94,31 @@ PYTHONPATH="${OLD_PYTHONPATH}"
 complete -r mesos
 EOF
 
+echo ""
+echo "Setup complete!"
+echo ""
+echo "To begin working, simply activate your virtual"
+echo "environment and deactivate it when you are done."
+echo ""
+
 if [ "${VIRTUALENV_DIRECTORY}" = "${CURRDIR}/.virtualenv" ]; then
   # Print some info about the sucess of the installation.
-  echo ""
-  echo "Setup complete!"
-  echo ""
-  echo "To begin working, simply activate your virtual"
-  echo "environment and deactivate it when you are done."
-  echo ""
   echo "    $ source activate"
   echo "    $ mesos <command> [<args>...]"
   echo "    $ source deactivate"
   echo ""
+else
+  echo "    $ source ${VIRTUALENV_DIRECTORY}/bin/activate"
+  echo "    $ source ${VIRTUALENV_DIRECTORY}/bin/postactivate"
+  echo "    $ mesos <command> [<args>...]"
+  echo "    $ source ${VIRTUALENV_DIRECTORY}/bin/predeactivate"
+  echo "    $ deactivate"
+  echo ""
+  echo "The postactivate and predeactivate files set up autocompletion."
+  echo "Add the mesos binary parent directory"
+  echo "${CURRDIR}/bin/"
+  echo "to your path, export it, and source"
+  echo "${CURRDIR}/mesos.bash_completion"
+  echo "to skip these two steps in the future."
+  echo ""
 fi

Reply via email to