From 745fa2b6ec4ebd1dfc9ddf37edfe6d42bcac8ca8 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Sep 12 2019 16:38:00 +0000 Subject: [PATCH 1/2] Update the %__python macro documentation after RPM 4.15 Also, there was no note below. --- diff --git a/guidelines/modules/ROOT/pages/Python.adoc b/guidelines/modules/ROOT/pages/Python.adoc index b05fb83..a3b7c94 100644 --- a/guidelines/modules/ROOT/pages/Python.adoc +++ b/guidelines/modules/ROOT/pages/Python.adoc @@ -175,8 +175,8 @@ The following macros are defined for you in all supported Fedora and EPEL releas |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+` From fe681763f11535d7080d69823d09c00e436f2bef Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Sep 12 2019 16:38:00 +0000 Subject: [PATCH 2/2] https://fedoraproject.org/wiki/Changes/Python_means_Python3 --- diff --git a/guidelines/modules/ROOT/pages/Python.adoc b/guidelines/modules/ROOT/pages/Python.adoc index a3b7c94..674da73 100644 --- a/guidelines/modules/ROOT/pages/Python.adoc +++ b/guidelines/modules/ROOT/pages/Python.adoc @@ -19,7 +19,8 @@ For guidelines on maintaining already existing python2 packages, see the xref:Py == 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 @@ Using a fictional module named "example", the subpackage containing the Python 3 === 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 diff --git a/guidelines/modules/ROOT/pages/Python_Appendix.adoc b/guidelines/modules/ROOT/pages/Python_Appendix.adoc index 15ee40d..94f6d70 100644 --- a/guidelines/modules/ROOT/pages/Python_Appendix.adoc +++ b/guidelines/modules/ROOT/pages/Python_Appendix.adoc @@ -334,10 +334,9 @@ For other executables, the general rule is: * 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