mirror of
https://github.com/ansible/ansible.git
synced 2026-08-02 00:22:14 +02:00
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.
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
# 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
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ prepend_path()
|
|||||||
PYTHONPATH=${PYTHONPATH-""}
|
PYTHONPATH=${PYTHONPATH-""}
|
||||||
PATH=${PATH-""}
|
PATH=${PATH-""}
|
||||||
MANPATH=${MANPATH-$(manpath)}
|
MANPATH=${MANPATH-$(manpath)}
|
||||||
PYTHON=$(command -v python || command -v python3)
|
PYTHON=$(command -v python3 || command -v python)
|
||||||
PYTHON_BIN=${PYTHON_BIN-$PYTHON}
|
PYTHON_BIN=${PYTHON_BIN-$PYTHON}
|
||||||
|
|
||||||
verbosity=${1-info} # Defaults to `info' if unspecified
|
verbosity=${1-info} # Defaults to `info' if unspecified
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ end
|
|||||||
|
|
||||||
# Set PYTHON_BIN
|
# Set PYTHON_BIN
|
||||||
if not set -q PYTHON_BIN
|
if not set -q PYTHON_BIN
|
||||||
if test (which python)
|
if test (which python3)
|
||||||
set -gx PYTHON_BIN (which python)
|
|
||||||
else if test (which python3)
|
|
||||||
set -gx PYTHON_BIN (which python3)
|
set -gx PYTHON_BIN (which python3)
|
||||||
|
else if test (which python)
|
||||||
|
set -gx PYTHON_BIN (which python)
|
||||||
else
|
else
|
||||||
echo "No valid Python found"
|
echo "No valid Python found"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user