`tools/dependency-check.sh`: Avoid confusing error message (#4423)

This commit is contained in:
Matthias Köppe 2024-01-25 21:29:27 -08:00 committed by GitHub
parent 1396c8c07a
commit cd9cb8d4a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -6,12 +6,21 @@ failure_exit() {
} }
check_python_version() { check_python_version() {
if [ -z "$PYMAJOR$PYMINOR" ]; then
echo >&2 "$0: This script expects that environment variables PYMAJOR and PYMINOR are set; skipping check_python_version"
return
fi
if ! command -v python"$PYMAJOR"."$PYMINOR" &> /dev/null; then if ! command -v python"$PYMAJOR"."$PYMINOR" &> /dev/null; then
echo >&2 "Must compile with python $PYMAJOR.$PYMINOR." echo >&2 "Must compile with python $PYMAJOR.$PYMINOR."
exit 1 exit 1
fi fi
} }
check_python_headers() { check_python_headers() {
if [ -z "$PYMAJOR$PYMINOR" ]; then
echo >&2 "$0: This script expects that environment variables PYMAJOR and PYMINOR are set; skipping check_python_headers"
return
fi
local python_headers_present local python_headers_present
python_headers_present=$(pkg-config --libs python-"$PYMAJOR"."$PYMINOR") python_headers_present=$(pkg-config --libs python-"$PYMAJOR"."$PYMINOR")