You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
970 B
Bash
34 lines
970 B
Bash
#!/usr/bin/env bash
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
INDENT=" "
|
|
POSSIBLE_PYTHONS=(
|
|
python
|
|
python2
|
|
python3
|
|
/usr/bin/python
|
|
/usr/bin/python2
|
|
/usr/bin/python3
|
|
# GitHub macOS 12 images: python2.7 is installed, but not on $PATH
|
|
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
|
|
)
|
|
|
|
for p in "${POSSIBLE_PYTHONS[@]}"; do
|
|
echo "$p"
|
|
if [[ ${p:0:1} == "/" && -e $p ]]; then
|
|
:
|
|
elif type "$p" > /dev/null 2>&1; then
|
|
type "$p" 2>&1 | sed -e "s/^/${INDENT}type: /"
|
|
else
|
|
echo "${INDENT}Not present"
|
|
echo
|
|
continue
|
|
fi
|
|
|
|
$p -c "import sys; print('${INDENT}version: %d.%d.%d' % sys.version_info[:3])"
|
|
# macOS builders lack a realpath command
|
|
$p -c "import os.path; print('${INDENT}realpath: %s' % os.path.realpath('$(type -p "$p")'))"
|
|
$p -c "import sys; print('${INDENT}sys.executable: %s' % sys.executable)"
|
|
echo
|
|
done
|