On Sun, Nov 17, 2019 at 9:17 PM Kaleb Keithley <kkeithle@redhat.com> wrote:
On Sun, Nov 17, 2019 at 8:09 PM Brad Hubbard <bhubbard@redhat.com> wrote:
On Wed, Apr 18, 2018 at 6:27 AM Nathan Cutler <ncutler@suse.cz> wrote:
That would be at odds to what Nathan is suggesting though, which is a hard change to Python 3.
Hm, not sure what hard/soft means in this context. For any given script, either it runs with Python 3, or it doesn't. And this is determined by the shebang. (Unless the shebang is omitted, of course.)
Apologies if this has already been mentioned, but FYI, Fedora (and RHEL and CentOS by extension) do not allow ambiguous python shebangs – they _require_ explicit versioned shebangs.
I presume that is what is meant by a hard change to Python3.
things like: #!/usr/bin/env python #!/usr/bin/python are not permitted.
(Also not #!/usr/bin/env $anything)
Shebangs – if there is one – in .py files must be either #!/usr/bin/python3 or #!/usr/bin/python2
AFAIK Fedora is enforcing it, kinda. Package builds in fedora run rpmlint which checks for these kinds of things, although I'm not sure this is a test yet or if there is a test that it scores high enough to fail a build. (Ditto for package builds in the OpenSUSE OBS, i.e. they also run rpmlint, although I haven't noticed python shebang tests there either.)
I can speak somewhat authoritatively on the Fedora situation, as I've helped with implementing it. In Fedora 31, we have transitioned all "unversioned" binaries from the Python stack from Python 2 to Python 3. All "unversioned" package names have also transitioned. See https://fedoraproject.org/wiki/Changes/Python_means_Python3 In Fedora 32, the aim is to retire nearly all of the Python 2 stack. The interpreter will remain and small selection of module packages will exist too (probably in the order of dozens). See https://fedoraproject.org/wiki/Changes/RetirePython2 We have enforced packages to pick either Python 2 or Python 3 for shebangs since Fedora 30 through a build-root policy script: https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error Somewhat relatedly, we automatically generate Python distribution dependencies by default since Fedora 30: https://fedoraproject.org/wiki/Changes/EnablingPythonGeneratorsByDefault Also related, this generator can be manually activated for EL7 and EL8 by adding the following to the top of a spec: # Enable Python dependency generation %{?python_enable_dependency_generator} You can see an example of that here: https://src.fedoraproject.org/rpms/python-hvac/blob/51406e2c7383bf15303ecf5c... openSUSE is orders of magnitude behind Fedora on this. All packages are still being built dual-stack, and the preference has not been switched from Python 2 to Python 3. There is no dependency generator for Python module dependencies, so getting a clear picture of the dependency web is much more complex. My understanding is that openSUSE will break the world on this only after Python 2 is retired from Factory in January 2020. It's going to be hard and painful, and it's because openSUSE is taking a *really* slow path to get there. -- 真実はいつも一つ!/ Always, there's only one truth!