#903 Update Python guidelines for Fedora 31
Merged 2 months ago by churchyard. Opened 5 months ago by churchyard.
churchyard/packaging-committee python_rpm4.15  into  master

@@ -19,7 +19,8 @@ 

  

  == Multiple Python Runtimes

  

- For backwards compatibility, `/usr/bin/python` is, if it is installed, a symbolic link to `/usr/bin/python2`.

+ Since Fedora 31 `/usr/bin/python` is, if it is installed, a symbolic link to `/usr/bin/python3`.

+ It was a symbolic link to `/usr/bin/python2` on previous releases.

  

  Packages in Fedora MUST NOT use `/usr/bin/python`. Instead packages for Python 3 MUST use `/usr/bin/python3` (even if upstream supports both Python 2 and 3). As a result of that `/usr/bin/python` (as well as `/usr/bin/env python` and similar) MUST NOT be used in shebang lines or as a dependency of a package. As of Fedora 30, all uses of unversioned python executables in shebang lines will fail the build.

  These shebangs MUST be fixed. If it is necessary to disable the checks, please see the information in xref:index#_shebang_lines[Shebang lines].

@@ -116,13 +117,14 @@ 

  

  === The %python_provide macro

  

- In order to make the switch from Python 2 to Python 3 automatic, all packages that provide `+python3-%{srcname}+` (for any `+%{srcname}+`) SHOULD use the `+%python_provide+` macro with the package name, for example:

+ All packages that provide `+python3-%{srcname}+` (for any `+%{srcname}+`) SHOULD use the `+%python_provide+` macro with the package name, for example:

  

  ----

  %{?python_provide:%python_provide python3-%{srcname}}

  ----

  

- This eases distribution-wide renaming of Python packages. (For example, in the future a virtual provide of `+python-%{srcname}+` might become appropriate for Python 3 libraries. In that case, `+%python_provide+` will be changed to add it.) Packages that do not include this macro would need to be adapted to such changes manually.

+ In Fedora 31 and further, it adds a virtual provide of `+python-%{srcname}+` for Python 3 libraries.

+ For previous releases, it used to add the virtual provide for Python 2 libraries.

  

  == Automatic Provides with a standardized name

  

@@ -175,8 +177,8 @@ 

  |Notes

  

  |`+%{__python}+`

- |`+/usr/bin/python+`

- |Prohibited (see note below).

+ |`+/usr/bin/python+` (for backwards compatibility)

+ |Don't use this macro without redefining it. Defining is changes the meaning of other "unversioned" Python macros such as `+%{python_sitelib}+`.

  

  |`+%{__python3}+`

  |`+/usr/bin/python3+`

@@ -334,10 +334,9 @@ 

  

  * If only one executable is to be shipped, then it owns its own slot and should use /usr/bin/python3.

  * If executables are to be shipped for both python 2 and python 3:

- ** Both python 2 and python 3 variants must provide symlinks with a '-X' and '-X.Y' suffix (python runtime major version, or python runtime major.minor version), unless upstream already provides appropriately versioned executables without the dash.

- ** The unversioned executable *should* be the python3 version, unless it would break users expectations, in that case it *may* be the python2 version.

- ** For example, the python3 version of "twisted" *must* ship executables `+/usr/bin/twistd-3+` and `+/usr/bin/twistd-3.7+` (assuming python3 is currently version 3.7) and it *should* ship `+/usr/bin/twistd+`; while the python2 version *must* provide `+/usr/bin/twistd-2+` and `+/usr/bin/twistd-2.7+`.

- ** As an example of the exception, users might except that the `+ipython+` command will run the same Python version as `+python+`.

+ ** Both python 2 and python 3 variants MUST provide symlinks with a '-X' and '-X.Y' suffix (python runtime major version, or python runtime major.minor version), unless upstream already provides appropriately versioned executables without the dash.

+ ** The unversioned executable MUST be the python3 version.

+ ** For example, the python3 version of "twisted" MUST ship executables `+/usr/bin/twistd-3+` and `+/usr/bin/twistd-3.7+` (assuming python3 is currently version 3.7) and `+/usr/bin/twistd+`; while the python2 version MUST provide `+/usr/bin/twistd-2+` and `+/usr/bin/twistd-2.7+`.

  ** For compatibility packages, the Python version is appended *after* the specific package version, for example `+/usr/bin/coverage-v1.2-3+` and `+/usr/bin/coverage-v1.2-3.4+` for python3-coverage1.2 compat package.

  

  === Running 2to3 from the spec file

no initial comment

Technically I guess we should mention that (with the current PR against python-rpm-macros) attempting to use %__python will result in an error parsing the specfile.

I agree. Marking this WIP.

rebased onto db3f242f697ecb5424f2a4f59ab899cdb6bf69d7

4 months ago

1 new commit added

  • https://fedoraproject.org/wiki/Changes/Python_means_Python3
4 months ago

rebased onto d482001

3 months ago

Metadata Update from @churchyard:
- Pull-request tagged with: meeting

3 months ago

This reflects the reality.

Metadata Update from @churchyard:
- Pull-request untagged with: meeting
- Request assigned

2 months ago

rebased onto 745fa2b

2 months ago

Pull-Request has been merged by churchyard

2 months ago