From Fedora Project Wiki
m (Typo)
m (Be a bit more serious)
Line 249: Line 249:
** Drop the macros. Disable the `python2dist()`/`python2.7dist()` dependency generators.
** Drop the macros. Disable the `python2dist()`/`python2.7dist()` dependency generators.
** No longer require {{package|python2-rpm-macros}} and {{package|python3-rpm-generators}} from {{package|python2.7}}.
** No longer require {{package|python2-rpm-macros}} and {{package|python3-rpm-generators}} from {{package|python2.7}}.
** Fix packages with FESCo exceptions (except already broken trac plugins), let the other affected packages burn.
** Fix packages with FESCo exceptions (except already broken trac plugins), leave the other affected packages broken for the maintainers to fix.
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->


Line 260: Line 260:
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->


* Policies and guidelines: the Python 2 guidelines will be obliviated<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Policies and guidelines: the Python 2 guidelines will be deleted<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Do the packaging guidelines or other documents need to be updated for this feature?  If so, does it need to happen before or after the implementation is done?  If a FPC ticket exists, add a link here. -->
<!-- Do the packaging guidelines or other documents need to be updated for this feature?  If so, does it need to happen before or after the implementation is done?  If a FPC ticket exists, add a link here. -->


* Trademark approval: (optional) Fedora Council to apply for a trademark for ''Die, Python 2, Die!''
* Trademark approval: Not neccessary.
<!-- If your Change may require trademark approval (for example, if it is a new Spin), file a ticket ( https://pagure.io/Fedora-Council/tickets/issues ) requesting trademark approval from the Fedora Council. This approval will be done via the Council's consensus-based process. -->
<!-- If your Change may require trademark approval (for example, if it is a new Spin), file a ticket ( https://pagure.io/Fedora-Council/tickets/issues ) requesting trademark approval from the Fedora Council. This approval will be done via the Council's consensus-based process. -->


Line 319: Line 319:
* Contingency deadline: Beta freeze.  <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Contingency deadline: Beta freeze.  <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
* Blocks release? Yes, let's not release a new Fedora version unless this is accepted. <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks release? No. <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks product? All of them. <!-- Applicable for Changes that blocks specific product release/Fedora.next -->
* Blocks product? No. <!-- Applicable for Changes that blocks specific product release/Fedora.next -->


== Documentation ==
== Documentation ==

Revision as of 17:15, 14 January 2021


Remove Python2 RPM Macros

Summary

The Package-x-generic-16.pngpython2-rpm-macros package (containing /usr/lib/rpm/macros.d/macros.python2) will be removed from Fedora 34 and newer. The python2 RPM macros will ceases to exist. Python 2 packages are already not allowed. Around a dozen of packages use the macros in Fedora and will need to be adjusted either by expanding them or by no longer using Python 2. The python2.7dist() and python2dist() automatic provides/requires will no longer be automatically generated.

Owner

Current status

  • Targeted release: Fedora 34
  • Last updated: 2021-01-14
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

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 RPM macros from the Package-x-generic-16.pngpython2-rpm-macros package (located at /usr/lib/rpm/macros.d/macros.python2) and hence decided to remove the package. The following macros will be undefined:

%{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

The following macros will remain defined 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 removed.

Package-x-generic-16.pngpython2.7 will no longer require Package-x-generic-16.pngpython2-rpm-macros and Package-x-generic-16.pngpython3-rpm-generators.

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

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

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

Packages that used to use those macros in Fedora will need to be adapted to expand the macros or switch to Python 3. In January 2021, we have:

  • several Python 2 trac plugins, but Package-x-generic-16.pngtrac uses Python 3 now
    • only those require python2dist(...)
  • several Python 2 sugar packages, but they already don't build or install as Package-x-generic-16.pngsugar uses Python 3 now
  • 14 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-numpy (requires python2.7dist(setuptools))
    • 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.

The removed macros and migration plan:

%{python2_sitelib}

Affected Fedora packages:

  • avahi
  • NFStest
  • offlineimap
  • python2-dns
  • python2-setuptools
  • python-six

Migration plan if not possible to switch to Python 3 / retire: Use %{_prefix}/lib/python2.7/site-packages.

%{python2_sitearch}

Affected Fedora packages:

  • chromium
  • offlineimap
  • pygobject2
  • pygtk2
  • python2-cairo
  • python2-numpy
  • python-psutil

Migration plan if not possible to switch to Python 3 / retire: Use %{_libdir}/python2.7/site-packages.

%{python2_version}

Affected Fedora packages:

  • offlineimap
  • pygtk2
  • python2-numpy
  • python2-setuptools

Migration plan if not possible to switch to Python 3 / retire: Use 2.7.

%{python2_version_nodots}

No affected Fedora packages.

Migration plan: Use 27.

%{python2_platform}

No affected Fedora packages.

Migration plan: Use a glob like linux-*.

%{py2_shbang_opts}, %{py2_shbang_opts_nodash}, %{py2_shebang_flags}, %py2_shebang_fix

Affected Fedora packages:

  • gimp-layer-via-copy-cut
  • gimp-resynthesizer
  • offlineimap

All use pathfix.py -pni "%{__python2} %{py2_shbang_opts}" ...

Migration plan: pathfix.py -pni "%{_bindir}/python2" -kas ...

%py2_build, %py2_install

Affected Fedora packages:

  • NFStest
  • offlineimap
  • python2-cairo
  • python2-dns
  • python2-setuptools
  • python-psutil
  • python-six

Migration plan:

%build
%set_build_flags
python2 setup.py build

%install
python2 setup.py install --skip-build --root %{buildroot}

Note: Add additional sleep 1 after/before the build if you also build for Python 3.

%py2_build_egg, %py2_build_wheel, %py2_install_egg, %py2_install_wheel

No affected Fedora packages. There are no build dependencies in Fedora to build a Python 2 wheel or install it.

Migration plan for egg: Please don't use this!

%build
%set_build_flags
python2 setup.py bdist_egg
%install
python2 -m easy_install -m --prefix %{buildroot}%{_prefix} -Z <path_to_egg>

Feedback

Benefit to Fedora

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 14 packages. We want to discourage building Python 2 packages. We want to remove the package from RHEL 9 as well.

Scope

  • Proposal owners:
    • Drop the macros. Disable the python2dist()/python2.7dist() dependency generators.
    • No longer require Package-x-generic-16.pngpython2-rpm-macros and Package-x-generic-16.pngpython3-rpm-generators from Package-x-generic-16.pngpython2.7.
    • Fix packages with FESCo exceptions (except already broken trac plugins), leave the other affected packages broken for the maintainers to fix.
  • Other developers:
    • Fix their packages by migrating to Python 3 or expanding the macros.
  • Release engineering: no impact on Release Engineering is anticipated
  • Policies and guidelines: the Python 2 guidelines will be deleted
  • Trademark approval: Not neccessary.
  • Alignment with Objectives: Not really.

Upgrade/compatibility impact

None.

How To Test

Check the macros are not defined.

Packager Experience

Intentionally horrible.

Dependencies

None.

Contingency Plan

  • Contingency mechanism: If this fails, we'll introduce the macros as a separate component and orphan it.
  • Contingency deadline: Beta freeze.
  • Blocks release? No.
  • Blocks product? No.

Documentation

This page is the documentation for the affected packagers.

Release Notes