Update hacking `env_setup` to prefer Python 3 (#75213)

* 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.
pull/75256/head
Sam Doran 3 years ago committed by GitHub
parent 3ba2243ba3
commit 93e72c96f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
#!/bin/sh
# usage: source hacking/env-setup [-q]
# modifies environment for running Ansible from checkout
@ -22,7 +22,7 @@ prepend_path()
PYTHONPATH=${PYTHONPATH-""}
PATH=${PATH-""}
MANPATH=${MANPATH-$(manpath)}
PYTHON=$(command -v python || command -v python3)
PYTHON=$(command -v python3 || command -v python)
PYTHON_BIN=${PYTHON_BIN-$PYTHON}
verbosity=${1-info} # Defaults to `info' if unspecified

@ -47,10 +47,10 @@ end
# Set PYTHON_BIN
if not set -q PYTHON_BIN
if test (which python)
set -gx PYTHON_BIN (which python)
else if test (which python3)
if test (which python3)
set -gx PYTHON_BIN (which python3)
else if test (which python)
set -gx PYTHON_BIN (which python)
else
echo "No valid Python found"
exit 1

Loading…
Cancel
Save