Merge changes from v1 env-setup into v2/env-setup

This commit is contained in:
Toshio Kuratomi 2015-01-27 11:53:58 -08:00
parent 35b4e6a3d0
commit 418e24cc6c

View file

@ -1,11 +1,15 @@
# usage: source ./hacking/env-setup [-q] # usage: source hacking/env-setup [-q]
# modifies environment for running Ansible from checkout # modifies environment for running Ansible from checkout
# Default values for shell variables we use # Default values for shell variables we use
PYTHONPATH=${PYTHONPATH-""} PYTHONPATH=${PYTHONPATH-""}
PATH=${PATH-""} PATH=${PATH-""}
MANPATH=${MANPATH-""} MANPATH=${MANPATH-""}
VERBOSITY=${1-""} verbosity=${1-info} # Defaults to `info' if unspecified
if [ "$verbosity" = -q ]; then
verbosity=silent
fi
# When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE # When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE
if [ -n "$BASH_SOURCE" ] ; then if [ -n "$BASH_SOURCE" ] ; then
@ -36,10 +40,10 @@ expr "$MANPATH" : "${PREFIX_MANPATH}.*" > /dev/null || export MANPATH="$PREFIX_M
gen_egg_info() gen_egg_info()
{ {
python setup.py egg_info python setup.py egg_info
if [ -e "$PREFIX_PYTHONPATH/ansible*.egg-info" ] ; then if [ -e "$PREFIX_PYTHONPATH/ansible.egg-info" ] ; then
rm -r "$PREFIX_PYTHONPATH/ansible*.egg-info" rm -r "$PREFIX_PYTHONPATH/ansible.egg-info"
fi fi
mv "ansible*.egg-info" "$PREFIX_PYTHONPATH" mv "ansible.egg-info" "$PREFIX_PYTHONPATH"
} }
if [ "$ANSIBLE_HOME" != "$PWD" ] ; then if [ "$ANSIBLE_HOME" != "$PWD" ] ; then
@ -48,29 +52,25 @@ else
current_dir="$ANSIBLE_HOME" current_dir="$ANSIBLE_HOME"
fi fi
cd "$ANSIBLE_HOME" cd "$ANSIBLE_HOME"
#if [ "$VERBOSITY" = "-q" ] ; then #if [ "$verbosity" = silent ] ; then
# gen_egg_info 2>1 1> /dev/null # gen_egg_info > /dev/null 2>&1
#else #else
# gen_egg_info # gen_egg_info
#fi #fi
cd "$current_dir" cd "$current_dir"
# if [ "$verbosity" != silent ] ; then
# Print out values unless -q is set cat <<- EOF
#
Setting up Ansible to run out of checkout...
if [ "$VERBOSITY" != "-q" ] ; then
echo "" PATH=$PATH
echo "Setting up Ansible to run out of checkout..." PYTHONPATH=$PYTHONPATH
echo "" MANPATH=$MANPATH
echo "PATH=$PATH"
echo "PYTHONPATH=$PYTHONPATH" Remember, you may wish to specify your host file with -i
echo "MANPATH=$MANPATH"
echo "" Done!
echo "Remember, you may wish to specify your host file with -i" EOF
echo ""
echo "Done!"
echo ""
fi fi