#!/bin/sh # python wrapper trying to fix the python versioning hell # -- pancake PCS="${PYTHON_CONFIG} python3.12 python3.11 python3 python39 python3.9 python-3.9 python38 python3.8 python-3.8 python37 python3.7 python-3.7 python" PYCFG="" for a in ${PCS} ; do $a --help >/dev/null 2>&1 if [ $? = 0 ]; then PYCFG="$a" PY3="`$a --version 2>&1 | grep 'Python 3'`" [ -n "${PY3}" ] && break fi done [ -z "${PYCFG}" ] && exit 1 if [ "$1" = "-n" ]; then echo ${PYCFG} exit 0 fi STATUSFILE=$(mktemp "${TMPDIR:-/tmp}/python-wrapper.XXXXXX") || exit 1 ( "${PYCFG}" "$@" echo $? >"${STATUSFILE}" ) | sed -e 's/-arch [^[:space:]]*//g' | sed 's/-Wstrict-prototypes//g' 2>/dev/null STATUS=$(cat "${STATUSFILE}" 2>/dev/null) rm -f "${STATUSFILE}" exit "${STATUS:-1}"