-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Packaging] Bump Python to 3.12 on RHEL and CentOS Stream #31264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @bebound, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
5e9d217 to
55c10b9
Compare
|
|
||
| # Fix up %{buildroot} appearing in some files... | ||
| for d in %{buildroot}%{cli_lib_dir}/bin/*; do perl -p -i -e "s#%{buildroot}##g" $d; done; | ||
| rm %{buildroot}%{cli_lib_dir}/pyvenv.cfg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el9.x86_64/usr/lib64/az/pyvenv.cfg content is
home = /usr/bin
include-system-site-packages = false
version = 3.12.5
executable = /usr/bin/python3.12
command = /usr/bin/python3.12 -m venv /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el9.x86_64/usr/lib64/az
It raises this error during build.
#10 83.39 RPM build errors:
#10 83.39 error: Bad exit status from /var/tmp/rpm-tmp.ZBlRUB (%install)
#10 83.39 Bad exit status from /var/tmp/rpm-tmp.ZBlRUB (%install)
#10 ERROR: process "/bin/sh -c export PIP_INDEX_URL=$(cat /run/secrets/PIP_INDEX_URL) && dos2unix ./scripts/release/rpm/azure-cli.spec && REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=$python_package PYTHON_CMD=$python_package rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && mkdir /out && cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /out/" did not complete successfully: exit code: 1
------
> [build-env 6/6] RUN --mount=type=secret,id=PIP_INDEX_URL export PIP_INDEX_URL=$(cat /run/secrets/PIP_INDEX_URL) && dos2unix ./scripts/release/rpm/azure-cli.spec && REPO_PATH=$(pwd) CLI_VERSION=2.71.0 PYTHON_PACKAGE=python3.12 PYTHON_CMD=python3.12 rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && cp /root/rpmbuild/RPMS/*/azure-cli-2.71.0-1.*.rpm /azure-cli-dev.rpm && mkdir /out && cp /root/rpmbuild/RPMS/*/azure-cli-2.71.0-1.*.rpm /out/:
82.82 + mkdir -p /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el8.x86_64/etc/bash_completion.d/
82.82 + cat /azure-cli/az.completion
82.82 + /usr/lib/rpm/check-buildroot
83.38 /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el8.x86_64/usr/lib64/az/pyvenv.cfg:command = /usr/bin/python3.12 -m venv /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el8.x86_64/usr/lib64/az
83.38 Found '/root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el8.x86_64' in installed files; aborting
83.39
83.39
83.39 RPM build errors:
83.39 error: Bad exit status from /var/tmp/rpm-tmp.ZBlRUB (%install)
83.39 Bad exit status from /var/tmp/rpm-tmp.ZBlRUB (%install)
In 3.9, pyvenv.cfg does not include rpmbuild root:
home = /usr/bin
include-system-site-packages = false
version = 3.9.20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/lib/rpm/check-buildroot wants to make sure the RPM build path /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el9.x86_64 does not exist in any of the installed file, but pyvenv.cfg contains command = /usr/bin/python3.12 -m venv /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el9.x86_64/usr/lib64/az which makes /usr/lib/rpm/check-buildroot fail.
- Will deleting
pyvenv.cfgcause any side effect? - Can we use
sedorperl(L60) to only removecommand = /usr/bin/python3.12 -m venv /root/rpmbuild/BUILDROOT/azure-cli-2.71.0-1.el9.x86_64/usr/lib64/az?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyvenv.cfg contains some metadata of the venv. We only need the site-pacakges folder in the venv.
This is the RPM entry script:
| AZ_INSTALLER=RPM PYTHONPATH=\"\$bin_dir/../lib64/az/lib/${python_version}/site-packages\" \$python_cmd -sm azure.cli \"\$@\" |
I thinks it's fine to remove it. As a proof, we have explicitly excluded the bin folder created by venv:
| %exclude %{cli_lib_dir}/bin/ |
PS: Although {cli_lib_dir}/bin/ is excluded in RPM, it still checks whether this path contains hard-coded buildroot during the build. Line 60 is still necessary.
| dnf --nogpgcheck install /mnt/rpm/$RPM_NAME -y | ||
|
|
||
| dnf install git gcc $PYTHON_PACKAGE-devel findutils -y | ||
| dnf install git gcc $PYTHON_PACKAGE-devel findutils $PYTHON_PACKAGE-pip -y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python3.12-devel installs python3.12-pip-wheel, which is only a pip wheel used in venv and does not install pip module in python3.12.
I need to install python3.12-pip explicitly as it's used in line 18
PS: In 3.9, python39-devel installs python39-pip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the content of https://mirror.stream.centos.org/9-stream/AppStream/aarch64/os/Packages/python3.12-pip-wheel-23.2.1-4.el9.noarch.rpm and it contains python3.12-pip-wheel-23.2.1-4.el9.noarch.cpio\.\usr\share\python3.12-wheels\pip-23.2.1-py3-none-any.whl.
https://docs.redhat.com/de/documentation/red_hat_enterprise_linux/9/html-single/installing_and_using_dynamic_programming_languages/index#proc_installing-additional-python-3-packages_assembly_installing-and-using-python contains instruction for installing python3.12-pip:
dnf install python3.12-pip
Actually I am wondering if we really need python3.12-devel at all:
This package contains the header files and configuration needed to compile
Python extension modules (typically written in C or C++), to embed Python
into other programs, and to make binary distributions for Python libraries.
It also contains the necessary macros to build RPM packages with Python modules
and 2to3 tool, an automatic source converter from Python 2.X.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gcc and python3-devel is introduced in #14806.
It seems fine to remove them.
| RUN --mount=type=secret,id=PIP_INDEX_URL export PIP_INDEX_URL=$(cat /run/secrets/PIP_INDEX_URL) && \ | ||
| dos2unix ./scripts/release/rpm/azure-cli.spec && \ | ||
| REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=$python_package PYTHON_CMD=python3.9 \ | ||
| REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=$python_package PYTHON_CMD=$python_package \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In RHEL8, the PYTHON_PACKAGE is python39, PYTHON_CMD is python3.9.
In RHEL9, both are unified as python3.9. Ref: https://github.com/Azure/azure-cli/pull/23556/files#r952101959
In python3.12, both distros use python3.12.
I'm unsure if these values will differ in the future; keep these variables for now.
|
Hi, I don't think you can do this if you actually want to support all rhel8 versions that are currently supported by Red Hat. |
Description
Close #30505
This PR bumps the Python dependency to 3.12. Some extensions may need to be reinstalled if they become non-functional:
az extension remove -n xxx && az extension add -n xxxAfter this PR, Mariner 2.0 is the only one relies on Python 3.9, the rest of the distros use 3.12.