From eecf94cc8efe8f0201c029e8e47e9127a2d72ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= Date: Thu, 3 Jul 2025 09:38:26 -0300 Subject: [PATCH] bin: explicitly use `python3` instead of `python` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- bin/python-venv.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/python-venv.sh b/bin/python-venv.sh index b394bbcd061..4afc01c137a 100755 --- a/bin/python-venv.sh +++ b/bin/python-venv.sh @@ -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 "$@"