macOS ARM, Python: Combine Python provisioning into common script

The Python provisioning on macOS ARM hosts is done multiple times
across separate targets.

This patch moves the code into a common script 'macos/python-arm.sh'.
As a drive-by, we bump the version of all targets to 3.12.11, whch is
the same as the one used in the macOS 15 ARM host.

Pick-to: 6.11 6.10 6.8
Change-Id: I8c1f6f7d635fe47b9faa34dbe6988e89252dc2c9
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
This commit is contained in:
Nils Petter Skålerud
2025-11-24 13:10:43 +01:00
committed by Nils Petter Skålerud
parent bb77943c0f
commit f0b54a51f7
7 changed files with 52 additions and 141 deletions

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Copyright (C) 2025 The Qt Company Ltd.
# Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 on macOS ARM hosts.
# shellcheck source=../unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
# Use 3.12 as a default python
# Note: Make sure that it's a version where dependencies are stored in CI-files.
python_ver="3.12.11"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install "$python_ver"
/Users/qt/.pyenv/versions/$python_ver/bin/pip3 install --user virtualenv wheel html5lib
/Users/qt/.pyenv/versions/$python_ver/bin/pip3 install --user -r ${BASH_SOURCE%/*}/../shared/requirements.txt
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/$python_ver/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/$python_ver/bin/"
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
# Provisioning during installation says:
# 'The script sbom2doc is installed in '$HOME/.local/bin' which is not on PATH.'
# hence the explicit assignment to SBOM_PYTHON_APPS_PATH.
SetEnvVar "SBOM_PYTHON_APPS_PATH" "/Users/qt/.local/bin"
# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements
SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/Users/qt/.pyenv/versions/$python_ver/bin/python3"
echo "python3 = $python_ver" >> ~/versions.txt

View File

@@ -3,20 +3,7 @@
# Copyright (C) 2017 Pelagicore AG # Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 set -euox pipefail
# shellcheck source=../common/unix/SetEnvVar.sh # shellcheck source=../common/macos/python-arm.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" source "${BASH_SOURCE%/*}/../common/macos/python-arm.sh"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install 3.9.7
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user virtualenv wheel html5lib
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
# Use 3.9 as a default python
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
echo "python3 = 3.9.7" >> ~/versions.txt

View File

@@ -3,29 +3,7 @@
# Copyright (C) 2017 Pelagicore AG # Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 set -euox pipefail
# shellcheck source=../common/unix/SetEnvVar.sh # shellcheck source=../common/macos/python-arm.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" source "${BASH_SOURCE%/*}/../common/macos/python-arm.sh"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install 3.9.7
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user virtualenv wheel html5lib
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user -r ${BASH_SOURCE%/*}/../common/shared/requirements.txt
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
# Use 3.9 as a default python
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
# Provisioning during installation says:
# 'The script sbom2doc is installed in '$HOME/.local/bin' which is not on PATH.'
# hence the explicit assignment to SBOM_PYTHON_APPS_PATH.
SetEnvVar "SBOM_PYTHON_APPS_PATH" "/Users/qt/.local/bin"
# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements
SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/python3"
echo "python3 = 3.9.7" >> ~/versions.txt

View File

@@ -3,29 +3,7 @@
# Copyright (C) 2017 Pelagicore AG # Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 set -euox pipefail
# shellcheck source=../common/unix/SetEnvVar.sh # shellcheck source=../common/macos/python-arm.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" source "${BASH_SOURCE%/*}/../common/macos/python-arm.sh"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install 3.9.7
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user virtualenv wheel html5lib
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user -r ${BASH_SOURCE%/*}/../common/shared/requirements.txt
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
# Use 3.9 as a default python
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
# Provisioning during installation says:
# 'The script sbom2doc is installed in '$HOME/.local/bin' which is not on PATH.'
# hence the explicit assignment to SBOM_PYTHON_APPS_PATH.
SetEnvVar "SBOM_PYTHON_APPS_PATH" "/Users/qt/.local/bin"
# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements
SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/python3"
echo "python3 = 3.9.7" >> ~/versions.txt

View File

@@ -3,29 +3,7 @@
# Copyright (C) 2017 Pelagicore AG # Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 set -euox pipefail
# shellcheck source=../common/unix/SetEnvVar.sh # shellcheck source=../common/macos/python-arm.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" source "${BASH_SOURCE%/*}/../common/macos/python-arm.sh"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install 3.9.7
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user virtualenv wheel html5lib
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user -r ${BASH_SOURCE%/*}/../common/shared/requirements.txt
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
# Use 3.9 as a default python
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
# Provisioning during installation says:
# 'The script sbom2doc is installed in '$HOME/.local/bin' which is not on PATH.'
# hence the explicit assignment to SBOM_PYTHON_APPS_PATH.
SetEnvVar "SBOM_PYTHON_APPS_PATH" "/Users/qt/.local/bin"
# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements
SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/python3"
echo "python3 = 3.9.7" >> ~/versions.txt

View File

@@ -3,29 +3,7 @@
# Copyright (C) 2017 Pelagicore AG # Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 set -euox pipefail
# shellcheck source=../common/unix/SetEnvVar.sh # shellcheck source=../common/macos/python-arm.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" source "${BASH_SOURCE%/*}/../common/macos/python-arm.sh"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install 3.12.11
/Users/qt/.pyenv/versions/3.12.11/bin/pip3 install --user virtualenv wheel html5lib
/Users/qt/.pyenv/versions/3.12.11/bin/pip3 install --user -r ${BASH_SOURCE%/*}/../common/shared/requirements.txt
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/3.12.11/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/3.12.11/bin/"
# Use 3.9 as a default python
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
# Provisioning during installation says:
# 'The script sbom2doc is installed in '$HOME/.local/bin' which is not on PATH.'
# hence the explicit assignment to SBOM_PYTHON_APPS_PATH.
SetEnvVar "SBOM_PYTHON_APPS_PATH" "/Users/qt/.local/bin"
# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements
SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/Users/qt/.pyenv/versions/3.12.11/bin/python3"
echo "python3 = 3.12.11" >> ~/versions.txt

View File

@@ -3,29 +3,7 @@
# Copyright (C) 2017 Pelagicore AG # Copyright (C) 2017 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs python3 set -euox pipefail
# shellcheck source=../common/unix/SetEnvVar.sh # shellcheck source=../common/macos/python-arm.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" source "${BASH_SOURCE%/*}/../common/macos/python-arm.sh"
export PYTHON_BUILD_MIRROR_URL="https://ci-files01-hki.ci.qt.io/input/python/"
export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
pyenv install 3.9.7
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user virtualenv wheel html5lib
/Users/qt/.pyenv/versions/3.9.7/bin/pip3 install --user -r ${BASH_SOURCE%/*}/../common/shared/requirements.txt
SetEnvVar "PYTHON3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
SetEnvVar "PIP3_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/"
# Use 3.9 as a default python
SetEnvVar "PATH" "\$PYTHON3_PATH:\$PATH"
# Provisioning during installation says:
# 'The script sbom2doc is installed in '$HOME/.local/bin' which is not on PATH.'
# hence the explicit assignment to SBOM_PYTHON_APPS_PATH.
SetEnvVar "SBOM_PYTHON_APPS_PATH" "/Users/qt/.local/bin"
# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements
SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/Users/qt/.pyenv/versions/3.9.7/bin/python3"
echo "python3 = 3.9.7" >> ~/versions.txt