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 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@lists.fedoraproject.org/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@lists.ceph.com
> http://lists.ceph.com/listinfo.cgi/sepia-ceph.com



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