## Description
This commit includes improvements and optimizations to the script:
- Clarified the purpose of the quiet flag with a comment.
- Adjusted conditions for appending to PYTHONPATH and MANPATH variables.
- Enhanced Python executable check for reliability and cross-platform support.
- Improved comments and function clarity.
- Ensured consistency with the original code.
These changes enhance readability, efficiency, and maintainability of the script.
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
* env_setup - Prefer Python3
Prefer the 'python3' executable over 'python'.
* Add shebang for syntax detection
While the script isn't executable and we recommend sourcing it, having a shebang allows
variuos text editors to detect that it is a shell script and apply proper syntax highlighting.
* Add test runner to PATH
* Add Python3 support
* Updating env-setup.fish to use more portable '-exec' rather than '-delete'
* Create gen_egg_info function
Move code into a function similar to env-setup.
Silence all output when run with -q
* 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.
include the lib/ directory.
Before - PYTHONPATH is empty.. ansible fails to run
$ source hacking/env-setup.fish
Appending PYTHONPATH
Setting up Ansible to run out of checkout...
PATH=/Volumes/opt/src/ansible/bin /usr/local/share/python3 /usr/local/bin
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/bin /sbin
/usr/local/bin /Users/ms/bin/
PYTHONPATH=
ANSIBLE_LIBRARY=/Volumes/opt/src/ansible/library
...
Traceback (most recent call last):
File "/Volumes/opt/src/ansible/bin/ansible", line 25, in <module>
from ansible.runner import Runner
ImportError: No module named ansible.runner
After change - it's set.. ansible runs.
source hacking/env-setup.fish
Appending PYTHONPATH
Setting up Ansible to run out of checkout...
PATH=/Volumes/opt/src/ansible/bin /usr/local/share/python3 /usr/local/bin
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/bin /sbin
/usr/local/bin /Users/ms/bin/
PYTHONPATH=/Volumes/opt/src/ansible/lib:
ANSIBLE_LIBRARY=/Volumes/opt/src/ansible/library
....
$ ansible
Usage: ansible <host-pattern> [options]