On Mon, Nov 18, 2019 at 12:17 PM Kaleb Keithley <kkeithle(a)redhat.com> wrote:
On Sun, Nov 17, 2019 at 8:09 PM Brad Hubbard <bhubbard(a)redhat.com> wrote:
On Wed, Apr 18, 2018 at 6:27 AM Nathan Cutler <ncutler(a)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.)
Does this mean you can no longer write a script that supports both
python 2 and 3? Or, you can write it that way but it will only ever be
run against python2 OR python3 so there is no point? Is it expected
you would need two versions of a script if you wish to support both? I
realise questions of supporting both become less important going
forward and that the emphasis should be on migration to python 3 but
I'm interested in the answers to these questions nonetheless (not
placing the burden of answering them solely on your shoulders Kaleb).