Re: Python 2 exodus is happening now [Was: Re: [sepia] Transition to Python 3]

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

 



On Mon, Nov 18, 2019 at 12:43 PM Brad Hubbard <bhubbard@xxxxxxxxxx> wrote:
>
> On Mon, Nov 18, 2019 at 12:17 PM Kaleb Keithley <kkeithle@xxxxxxxxxx> wrote:
> >
> > On Sun, Nov 17, 2019 at 8:09 PM Brad Hubbard <bhubbard@xxxxxxxxxx> wrote:
> >>
> >> On Wed, Apr 18, 2018 at 6:27 AM Nathan Cutler <ncutler@xxxxxxx> 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).

Ignore this. I must have been having a mega brain-fade when I wrote it
and I still can't understand how I even formulated these questions.

Sorry for the noise.

>
> >
> >
> >>
> >> >
> >> > I was very surprised to find out that, in SLES and openSUSE, the symlink
> >> > /usr/bin/python -> /usr/bin/python2 will not be changed even when the
> >> > migration of the underlying distro to Python 3 is complete.
> >> >
> >> > But then my colleagues explained why that is, and I "saw the light".
> >> > Since every single script in the distro has to be audited for Python 3
> >> > compatibility, anyway, it makes sense to have the shebang be an explicit
> >> > declaration of said compatibility.
> >> >
> >> > By retaining the symlink at it is, all scripts start out the migration
> >> > process with an explicit declaration that they are compatible with
> >> > Python 2. Compatibility with Python 3 is signalled not by saying "it's
> >> > OK with Python 3, we tried it". It's signalled by changing the shebang.
> >> >
> >> > And this isn't unique to SUSE. Fedora is treating the shebang in the
> >> > same way, apparently. [2]
> >>
> >> Seems that if you only have python3 installed in Fedora31 this is
> >> *not* the case.
> >>
> >> # python --version
> >> Python 3.7.5
> >> # /usr/bin/python --version
> >> Python 3.7.5
> >> # ls -l /usr/bin/python
> >> lrwxrwxrwx. 1 root root 9 Nov 18 00:57 /usr/bin/python -> ./python3
> >>
> >> See https://lists.fedoraproject.org/archives/list/devel-announce@xxxxxxxxxxxxxxxxxxxxxxx/thread/NFMFRKHLPUEDXSADCNXJ2N5YHK2JG3PB/
> >> and https://fedoraproject.org/wiki/Changes/RetirePython2#The_python27_package
> >>
> >> "there is no /usr/bin/python"
> >>
> >> So the two distros are quite divergent in their approach apparently?
> >>
> >> >
> >> > It may be true that a given script is fine with Python 3, but as long as
> >> > the shebang says "python" (i.e. python2), there's no way to really find
> >> > out, is there? (Barring things like Josh's suggestion of changing the
> >> > shebang on the fly via a teuthology task/workunit, which is fine if we
> >> > decide we need a transition period, which it looks like we will.)
> >> >
> >> > Nathan
> >> >
> >> > [1]
> >> > https://github.com/kubernetes-incubator/external-storage/blob/master/ceph/cephfs/cephfs_provisioner/cephfs_provisioner.py#L27
> >> > [2]
> >> > https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3#.2Fusr.2Fbin.2Fpython
> >> > _______________________________________________
> >> > Sepia mailing list
> >> > Sepia@xxxxxxxxxxxxxx
> >> > http://lists.ceph.com/listinfo.cgi/sepia-ceph.com
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Brad
> >> _______________________________________________
> >> Dev mailing list -- dev@xxxxxxx
> >> To unsubscribe send an email to dev-leave@xxxxxxx
> >>
>
>
> --
> Cheers,
> Brad



-- 
Cheers,
Brad
_______________________________________________
Dev mailing list -- dev@xxxxxxx
To unsubscribe send an email to dev-leave@xxxxxxx




[Index of Archives]     [CEPH Users]     [Ceph Devel]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux