You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by kl...@apache.org on 2018/04/12 12:56:12 UTC

[1/2] mesos git commit: Improved documentation regarding the new CLI setup. [Forced Update!]

Repository: mesos
Updated Branches:
  refs/heads/master 3c1a0bce1 -> 237a121c4 (forced update)


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/2f7f03f2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2f7f03f2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2f7f03f2

Branch: refs/heads/master
Commit: 2f7f03f249a724d61265dabfadb5bb83eb2008e8
Parents: 99c73e0
Author: Armand Grillet <ag...@mesosphere.io>
Authored: Thu Apr 12 14:37:10 2018 +0200
Committer: Kevin Klues <kl...@gmail.com>
Committed: Thu Apr 12 14:43:34 2018 +0200

----------------------------------------------------------------------
 src/python/cli_new/README.md | 31 +++++++++++++++++++++++++++++--
 src/python/cli_new/bootstrap | 27 +++++++++++++++++++++------
 2 files changed, 50 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2f7f03f2/src/python/cli_new/README.md
----------------------------------------------------------------------
diff --git a/src/python/cli_new/README.md b/src/python/cli_new/README.md
index 847141d..3d646e9 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/2f7f03f2/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


[2/2] mesos git commit: Removed 'source activate' from new CLI wrapper scripts.

Posted by kl...@apache.org.
Removed 'source activate' from new CLI wrapper scripts.

Having these command in these scripts was only necessary if you wanted
to run them from outside the virtual environment they were meant to run
in. Since we will soon be allowing people to create this virtual
environment anywhere on their filesystem, it doesn't make sense to
assume they have done it in the 'src/python/cli_new' directory anymore.

Since we can't assume that, we will just have to mandate that the
virtualenv is actually set up before invoking these scripts.

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/237a121c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/237a121c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/237a121c

Branch: refs/heads/master
Commit: 237a121c47221cadcaa7836a48b5ed0371bf03f3
Parents: 2f7f03f
Author: Armand Grillet <ag...@mesosphere.io>
Authored: Thu Apr 12 14:43:54 2018 +0200
Committer: Kevin Klues <kl...@gmail.com>
Committed: Thu Apr 12 14:55:23 2018 +0200

----------------------------------------------------------------------
 src/python/cli_new/bin/mesos           | 1 -
 src/python/cli_new/bin/mesos-cli-tests | 1 -
 2 files changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/237a121c/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/237a121c/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 "$@"