From Fedora Project Wiki


Disable Python 2 Dist RPM Generators and Freeze Python 2 Macros

Summary

The python2.7dist() and python2dist() automatic provides/requires from python-rpm-generators will no longer be automatically generated, no functional packages in Fedora use them. The python(abi) = 2.7 automatic provides/requires will be kept.

The python2-rpm-macros package will be removed from Fedora 34 and newer. The python2 RPM macros (/usr/lib/rpm/macros.d/macros.python2) will be moved to python2.7 and frozen (no new development, except critical bugfixes that affect packages outside the remaining Python 2 ecosystem).

Note that Python 2 packages are already not allowed in Fedora, except explicitly granted exceptions.

Owner

Current status

Detailed Description

Python 2 is upstream dead, usage in Fedora packages is forbidden, except for several package with an explicit FESCo approved exception. The Python Maintenance team no longer wishes to support the python2 dist RPM generators from the python-rpm-generators package nor the python2 RPM macros from the python2-rpm-macros package (located at /usr/lib/rpm/macros.d/macros.python2) and hence decided to disable the generators for Python 2 and freeze the macros.

Provides/requires like this will no longer be automatically generated in Fedora:

python2dist(...)
python2.7dist(...)

Currently, no functional Fedora 34 packages need such provides. The python(abi) = 2.7 automatic provides/requires will be kept.

The following macro definitions will be moved from python2-rpm-macros to python2.7:

%{python2_sitelib}
%{python2_sitearch}
%{python2_version}
%{python2_version_nodots}
%{python2_platform}
%{py2_shbang_opts}
%{py2_shbang_opts_nodash}
%{py2_shebang_flags}
%py2_shebang_fix
%py2_build
%py2_build_egg
%py2_build_wheel
%py2_install
%py2_install_egg
%py2_install_wheel

And their definition will remain frozen unless a bug is found that affects Fedora packages outside the remaining Python 2 ecosystem. Packagers of Python 2 packages affected by bugs in the macros are encouraged to apply workarounds and/or submit fixes themselves.

Only the following packages use some of the macros:

  • several Python 2 trac plugins, but trac uses Python 3 now
    • only those require python2dist(...) / python2.7dist(...)
  • several Python 2 sugar packages, but they already don't build and/or install as sugar uses Python 3 now
  • 13 other affected packages in Fedora (some of them co-owned by Python Maint):
    • avahi
    • gimp-layer-via-copy-cut
    • gimp-resynthesizer
    • chromium
    • NFStest
    • offlineimap
    • pygobject2
    • pygtk2
    • python-psutil
    • python-six
    • python2-cairo
    • python2-dns
    • python2-setuptools

Note: Many other packages use the macros in a disabled %if section. Some of the listed ones might as well (and hence are not really impacted), the list is an intersection of packages that (Build)Require Python 2 and are greppable for the macros.

python2.7 will provide and obsolete python2-rpm-macros at least for 2 more releases (or until it is removed entirely from Fedora).

The following macros will remain defined in python-srpm-macros for the time being to not break packages that are using Python 2 as build-time only dependency (which is also not allowed, but happens more often):

%{__python2}
%{python2}

The Python 2 section of Python packaging guidelines will be amended to say that the Python 2 macros may not completely mirror the Python 3 macros.

The changes will happen after the Fedora 34 mass rebuild and before branching.

Feedback

At first, we have proposed to remove the macros entirely. That proposal has received negative feedback and we have reworked it to only freeze the macros and disable the dist generators.

Benefit to Fedora

With each change of the RPM Python dist generators we had to create artificial packages to test the impact on Python 2, because the real set of Python 2 package in Fedora is basically non-existent. By disabling them, we no longer have to worry about breaking things for our downstreams or projects building atop Fedora.

In the past, we tried to keep the macros as similar to their Python 3 counterparts as possible, but we have decided that it is not worth it for 13 packages. This way, historical packages can still be built atop Fedora with the macros, but we don't need to worry about keeping them up-to-date. Once python2.7 is retired, the macros will go away as well. This is also true for RHEL 9.

Scope

  • Other developers: No action required.
  • Release engineering: no impact on Release Engineering is anticipated
  • Policies and guidelines: a note will be added to the Python 2 guidelines
  • Trademark approval: Not necessary.
  • Alignment with Objectives: Not really.

Upgrade/compatibility impact

The python2-rpm-macros package will be obsoleted by python2.7. Users that happened to have the macros installed but not the interpreter will suddenly pull the interpreter on upgrades, but we think that's a reasonable compromise.

How To Test

Build a Python 2 package that used to provide and/or require python2.7dist() or python2dist() automatically. Verify it does not do that. Verify it still requires python(abi) = 2.7. Verify the macros are still defined. Verify python2-rpm-macros is no more. Verify python2.7 does not depend on RPM.

Packager Experience

Mildly worse for packagers building Python 2 RPMs atop Fedora. If such packagers need the dist generators to do so, they are encouraged to build their own version. Feel free to talk to the change owner about how to do that.

Fedora packages are not affected.

Dependencies

None.

Contingency Plan

  • Contingency mechanism: Revert the changes.
  • Contingency deadline: Beta freeze.
  • Blocks release? No.
  • Blocks product? No.

Documentation

This page is the documentation for the affected 3rd party packagers.

Release Notes