summaryrefslogtreecommitdiff
path: root/hacking
diff options
context:
space:
mode:
authorSam Doran <sdoran@redhat.com>2021-07-08 15:14:34 -0400
committerGitHub <noreply@github.com>2021-07-08 15:14:34 -0400
commit93e72c96f0339fba879bff9f99500fe55f0af446 (patch)
tree46ef714b6034b9c4dd4fe31ab2a001fafd52dc12 /hacking
parent3ba2243ba30e814b217abb5102969291a32f1708 (diff)
downloadansible-93e72c96f0339fba879bff9f99500fe55f0af446.tar.gz
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.
Diffstat (limited to 'hacking')
-rw-r--r--hacking/env-setup4
-rw-r--r--hacking/env-setup.fish6
2 files changed, 5 insertions, 5 deletions
diff --git a/hacking/env-setup b/hacking/env-setup
index fc0648751a..c9fbdbd55f 100644
--- a/hacking/env-setup
+++ b/hacking/env-setup
@@ -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
diff --git a/hacking/env-setup.fish b/hacking/env-setup.fish
index 0ef92cdc65..94126cad40 100644
--- a/hacking/env-setup.fish
+++ b/hacking/env-setup.fish
@@ -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