F29 System Wide Change: Move /usr/bin/python into a separate package

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



= Proposed System Wide Change: Move /usr/bin/python into a separate package =
https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package


Owner(s):
  * Petr Viktorin <python-devel at lists dot fedoraproject dot org>
  * Miro Hrončok <churchyard at fedoraproject dot org>


Reflecting the recent changes of
https://www.python.org/dev/peps/pep-0394/ PEP 394 -- ''The "python"
Command on Unix-Like Systems'', we are moving /usr/bin/python from the
python2 package into a separate package called
python-unversioned-command.
python2 will recommend this package.
This means Fedora users will get it automatically with python2, but
they might opt-out and remove it. In Fedora's build system, only
packages explicitly buildrequiring /usr/bin/python will get it.
This change obsoletes "Avoid /usr/bin/python in RPM build" change.

== Detailed description ==

=== Motivation ===

The meaning of the python command is ambiguous: it might mean either
Python 2 or Python 3, depending on context. The upstream
recommendation (PEP 394), which we try to follow in Fedora, is that
users -- not distros, and not sysadmins -- should be in control of the
python command.

Specifically, this means distro-packaged software should use python2
or python3 explicitly. Fedora's Python packaging guidelines have
suggested this since February 2015, and demand it since August 2017.
However, enforcing this guideline (which we will need to actually
allow users to safely change their python command) is problematic.
"Avoid /usr/bin/python in RPM_Build" change didn't work: most of the
packagers didn't change anything and too many packages still use the
python command.

Instead of developing custom hacks, we are now utilizing a more
systematic solution: If your package still needs /usr/bin/python to
build, explicitly BuildRequire it. If your package needs
/usr/bin/python to run, explicitly Require it. (In both cases, try to
use /usr/bin/python2 or /usr/bin/python3 instead if possible.)

We are also expecting some buildsystems (autools, cmake, etc.) to
automatically use /usr/bin/python2 if /usr/bin/python is unavailable,
so the problem might go away more naturally.

=== PEP 394 and how it is mapped to this change ===

Upstream PEP 394 -- The "python" Command on Unix-Like Systems
describes how the python command should behave. In Fedora, that's
/usr/bin/python. The PEP was recently updated to reflect upstream's
evolving views on the situation. Notable new information from the PEP
is:

In controlled environments aimed at expert users, where being explicit
is valued over user experience (for example, in test environments and
package build systems), distributions may choose to not provide the
python command even if python2 is available. (All software in such a
controlled environment must use python3 or python2 rather than python,
which means scripts that deliberately use python need to be modified
for such environments.)

We consider Fedora's build machinery a controlled environments aimed
at expert users.

=== What's changing ===

"Avoid /usr/bin/python in RPM_Build" change is reverted. Packages that
follow its Quick Opt-Out section (i.e. set
PYTHON_DISALLOW_AMBIGUOUS_VERSION) will be fixed by the owners of this
change.

/usr/bin/python remains a symbolic link to /usr/bin/python2. However,
it is moved to a new python-unversioned-command package (technically a
subpackage of python2). python2 package will only recommend
/usr/bin/python.

Packages that need /usr/bin/python to build will need to BuildRequire
it. Packages that need /usr/bin/python to be used by users will need
to Require it. In both cases, the packager should avoid the need and
only fallback to (Build)Requiring /usr/bin/python as a temporary
workaround.

The new package will virtually provide python, ensuring that dnf
install python will make the python command available.

=== Effect on automatic bytecompilation ===

When "No more automagic Python bytecompilation" change is done,
packages that byte-compile files outside of Python directories should
switch to the new behavior described in that change, and should not be
impacted by this change. However, if that change is delayed or
reverted, packagers that rely on the old behavior when byte compiling
files will need to set %__python to python2 or python3 explicitly.

=== Effect on %__python and other ambiguous RPM macros ===

Using ambiguous Python macros (%{__python}, %{python_sitelib}...) is
forbidden and your package will fail to build if you still use those
without redefining %__python. Either switch to explicitly versioned
macros (%{__python2}, %{python2_sitelib}, %{__python3}...) or set
__python to an explicit Python version.


== Scope ==
* Proposal owners:
** Split the packages as described in ''Detailed Description''.
** Fix packages that use PYTHON_DISALLOW_AMBIGUOUS_VERSION to
BuildRequire /usr/bin/python instead.

* Other developers:
** Maintainers of packages that use /usr/bin/python need to switch to
using /usr/bin/python3 or /usr/bin/python2 explicitly (with help from
''Proposal owners'' if needed).
*** While doing that, consider switching your package to Python 3
only, if the Python 2 bits are unused in Fedora. (This is not
necessarily required for this change, however it will make your
packaging job easier.)
*** If that can't be done in a timely manner, fallback to
(Build)Requiring /usr/bin/python as a temporary workaround.

* Release engineering:
** https://pagure.io/releng/issue/7511 #7511
** List of deliverables: N/A (not needed for this Change)

* Policies and guidelines:
** Already existing: "packages in Fedora ... MUST call the proper
executable for the needed python major version directly, either
/usr/bin/python2 or /usr/bin/python3 as appropriate" from
Packaging:Python#Multiple_Python_Runtimes..

* Trademark approval:
N/A (not needed for this Change)
-- 
Jan Kuřík
JBoss EAP Program Manager
Red Hat Czech s.r.o., Purkynova 99/71, 612 45 Brno, Czech Republic
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx/message/MSQFPKXLPOS2YLPWL4CQOXODMURSJR3H/




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux