Skip to content

Instantly share code, notes, and snippets.

@AdamGagorik
Created June 22, 2023 13:18
Show Gist options
  • Save AdamGagorik/7c30c42dbb6837a14e2fa0fe43817f3c to your computer and use it in GitHub Desktop.
Save AdamGagorik/7c30c42dbb6837a14e2fa0fe43817f3c to your computer and use it in GitHub Desktop.
#!/bin/bash
CAT=mdcat
function head() {
echo "---" | $CAT
echo "# $1"
echo ""
}
function info() {
head $1
PROG=`pyenv which $1 2> /dev/null`
if command -v "$PROG" 1> /dev/null; then
echo "VERSION : $($1 --version)"
echo "LOCATION : \`$(which $1)\`" | $CAT
if [[ "$2" == "--pyenv-which" ]]; then
echo "PYENVLOC : \`$(pyenv which $1)\`" | $CAT
fi
else
echo "> program not found!"
fi
echo ""
}
function show() {
head "$1"
$1
echo ""
}
if [[ -f .venv/bin/activate ]]; then
. ./.venv/bin/activate
fi
show "pyenv versions"
info python --pyenv-which
info python3 --pyenv-which
info poetry
if [[ $1 != "--yes" ]]; then
read -p "Show pip info? (y|Y): " -n 1 -r choice
case "$choice" in
y|Y) ;;
*)
if [[ ! "${choice}x" == "x" ]]; then
echo
fi
echo "exiting..."
exit
;;
esac
fi
echo
show "python -m site"
show "python3 -m site"
show "pip freeze"
info pip --pyenv-which
info pip3 --pyenv-which
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment