1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/hacking/env-setup.fish

69 lines
1.7 KiB
Fish
Raw Normal View History

2013-08-13 23:14:01 +02:00
#!/usr/bin/env fish
# usage: . ./hacking/env-setup [-q]
2013-08-13 23:14:01 +02:00
# 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*"
2013-08-14 18:46:58 +02:00
case "*"
2013-08-13 23:14:01 +02:00
echo "Appending PYTHONPATH"
set -gx PYTHONPATH "$PREFIX_PYTHONPATH:$PYTHONPATH"
2013-08-13 23:14:01 +02:00
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
2013-08-14 18:46:58 +02:00
2013-08-13 23:14:01 +02:00
set -gx ANSIBLE_LIBRARY $ANSIBLE_HOME/library
2013-08-14 18:46:58 +02:00
# Generate egg_info so that pkg_resources works
pushd $ANSIBLE_HOME
python setup.py egg_info
if test -e $PREFIX_PYTHONPATH/ansible*.egg-info
rm -r $PREFIX_PYTHONPATH/ansible*.egg-info
end
mv ansible*egg-info $PREFIX_PYTHONPATH
find . -type f -name "*.pyc" -delete
popd
2013-08-13 23:14:01 +02:00
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