From dbfcd787906e0de581ff2893825438cb49dbb82c Mon Sep 17 00:00:00 2001 From: Jharrod LaFon Date: Tue, 13 Aug 2013 15:14:01 -0600 Subject: [PATCH 1/3] Added an env-setup file for Fish --- hacking/env-setup.fish | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 hacking/env-setup.fish diff --git a/hacking/env-setup.fish b/hacking/env-setup.fish new file mode 100644 index 0000000000..811b76b7ce --- /dev/null +++ b/hacking/env-setup.fish @@ -0,0 +1,54 @@ +#!/usr/bin/env fish +# usage: source ./hacking/env-setup [-q] +# modifies environment for running Ansible from checkout +set HACKING_DIR (dirname (status -f)) +set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))") +set ANSIBLE_HOME (dirname $FULL_PATH) +set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib +set PREFIX_PATH $ANSIBLE_HOME/bin +set PREFIX_MANPATH $ANSIBLE_HOME/docs/man + +# Set PYTHONPATH +if not set -q PYTHONPATH + set -gx PYTHONPATH $PREFIX_PYTHONPATH +else + switch PYTHONPATH + case "$PREFIX_PYTHONPATH*" + echo "Appending PYTHONPATH" + set -gx PYTHONPATH $PREFIX_PYTHONPATH:$PYTHONPATH + end +end + +# Set PATH +if not contains $PREFIX_PATH $PATH + set -gx PATH $PREFIX_PATH $PATH +end + +# Set MANPATH +if not contains $PREFIX_MANPATH $MANPATH + if not set -q MANPATH + set -gx MANPATH $PREFIX_MANPATH + else + set -gx MANPATH $PREFIX_MANPATH $MANPATH + end +end +set -gx ANSIBLE_LIBRARY $ANSIBLE_HOME/library +if set -q argv + switch $argv + case '-q' '--quiet' + case '*' + echo "" + echo "Setting up Ansible to run out of checkout..." + echo "" + echo "PATH=$PATH" + echo "PYTHONPATH=$PYTHONPATH" + echo "ANSIBLE_LIBRARY=$ANSIBLE_LIBRARY" + echo "MANPATH=$MANPATH" + echo "" + + echo "Remember, you may wish to specify your host file with -i" + echo "" + echo "Done!" + echo "" + end +end From d0fe447fd13e581fd059a4ff20e910752d58e5d8 Mon Sep 17 00:00:00 2001 From: Jharrod LaFon Date: Wed, 14 Aug 2013 10:46:58 -0600 Subject: [PATCH 2/3] Fixed incorrectly set PYTHONPATH --- hacking/env-setup.fish | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hacking/env-setup.fish b/hacking/env-setup.fish index 811b76b7ce..05a5a8d671 100644 --- a/hacking/env-setup.fish +++ b/hacking/env-setup.fish @@ -14,6 +14,7 @@ if not set -q PYTHONPATH else switch PYTHONPATH case "$PREFIX_PYTHONPATH*" + case "*" echo "Appending PYTHONPATH" set -gx PYTHONPATH $PREFIX_PYTHONPATH:$PYTHONPATH end @@ -32,7 +33,9 @@ if not contains $PREFIX_MANPATH $MANPATH set -gx MANPATH $PREFIX_MANPATH $MANPATH end end + set -gx ANSIBLE_LIBRARY $ANSIBLE_HOME/library + if set -q argv switch $argv case '-q' '--quiet' From 996f87d89807f5b275d8e3a50962bef3b97096e6 Mon Sep 17 00:00:00 2001 From: Jharrod LaFon Date: Wed, 14 Aug 2013 15:52:37 -0600 Subject: [PATCH 3/3] Fixed usage comment to fish syntax for sourcing a file --- hacking/env-setup.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacking/env-setup.fish b/hacking/env-setup.fish index 05a5a8d671..1613baeb14 100644 --- a/hacking/env-setup.fish +++ b/hacking/env-setup.fish @@ -1,5 +1,5 @@ #!/usr/bin/env fish -# usage: source ./hacking/env-setup [-q] +# usage: . ./hacking/env-setup [-q] # modifies environment for running Ansible from checkout set HACKING_DIR (dirname (status -f)) set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))")