bin: explicitly use python3 instead of python
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The `python` command's default behaviour can vary between OSes and even
different versions of the same OS. On some systems, `python` might still
point to Python 2 for backward compatibility, while on others, it might
point to Python 3.

As Mesa already requires "Python 3.6 or newer", use `python3` explicitly
to ensure that the script is using a Python 3 interpreter.

Moreover, this commit allows this script to run on macOS, as macOS doesn't
have a `python` symlink or alias by default. Therefore, currently, when
running this script in macOS, you get a "python: command not found" error.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35918>
This commit is contained in:
Maíra Canal 2025-07-03 09:38:26 -03:00 committed by Marge Bot
parent 045ddb992a
commit eecf94cc8e

View file

@ -16,10 +16,10 @@ then
echo "Python environment predates Python version checks."
echo "It might be invalid and needs to be regenerated."
rm -rf "$venv_dir"
elif ! cmp --quiet <(python --version) "$venv_python_version"
elif ! cmp --quiet <(python3 --version) "$venv_python_version"
then
old=$(cat "$venv_python_version")
new=$(python --version)
new=$(python3 --version)
echo "Python version has changed ($old -> $new)."
echo "Python environment needs to be regenerated."
unset old new
@ -30,8 +30,8 @@ fi
if ! [ -r "$venv_dir/bin/activate" ]
then
echo "Creating Python environment..."
python -m venv "$venv_dir"
python --version > "$venv_python_version"
python3 -m venv "$venv_dir"
python3 --version > "$venv_python_version"
fi
# shellcheck disable=1091
@ -44,4 +44,4 @@ then
cp "$requirements_file" "$venv_req"
fi
python "$@"
python3 "$@"