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

Fish hacking setup fix (#18084)

* Remove old egg-info files before creating new ones

Currently, setup.py generates egg files then they are deleted. This change
fixes this behavior and matches that in env-setup.

* Do not try to move ansible*egg-info to lib/

setup.py creates the ansible.egg-info in lib/ so this step is unnecessary. Matches env-setup behavior.

* Better test for number of arguments in argv

This prevents an erronous error message from being thrown since set -q returns an error code with the number of variables not defined, resulting in a non-zero exit if no arguments are passed.

Indent case statement within switch statement.
This commit is contained in:
Sam Doran 2016-10-24 13:35:00 -04:00 committed by Toshio Kuratomi
parent c588bade1f
commit cf8639ff62

View file

@ -4,16 +4,16 @@
set HACKING_DIR (dirname (status -f)) set HACKING_DIR (dirname (status -f))
set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))") set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))")
set ANSIBLE_HOME (dirname $FULL_PATH) set ANSIBLE_HOME (dirname $FULL_PATH)
set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib
set PREFIX_PATH $ANSIBLE_HOME/bin set PREFIX_PATH $ANSIBLE_HOME/bin
set PREFIX_MANPATH $ANSIBLE_HOME/docs/man set PREFIX_MANPATH $ANSIBLE_HOME/docs/man
# set quiet flag # set quiet flag
if set -q argv if test (count $argv) -ge 1
switch $argv switch $argv
case '-q' '--quiet' case '-q' '--quiet'
set QUIET "true" set QUIET "true"
case '*' case '*'
end end
end end
@ -49,15 +49,14 @@ set -gx ANSIBLE_LIBRARY $ANSIBLE_HOME/library
# Generate egg_info so that pkg_resources works # Generate egg_info so that pkg_resources works
pushd $ANSIBLE_HOME pushd $ANSIBLE_HOME
if test -e $PREFIX_PYTHONPATH/ansible*.egg-info
rm -r $PREFIX_PYTHONPATH/ansible*.egg-info
end
if [ $QUIET ] if [ $QUIET ]
python setup.py -q egg_info python setup.py -q egg_info
else else
python setup.py egg_info python setup.py egg_info
end end
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 find . -type f -name "*.pyc" -delete
popd popd