correct #! for python

Andrew Bartlett abartlet at samba.org
Thu Dec 13 04:51:08 UTC 2018


Thanks everyone for their thoughts on what to set the shebang (#!)
lines to for Python files in master and so Samba 4.10.

For me, the way I see it is that Samba is now a Python3 project that we
are keeping source-compatible with Python2 under limited conditions.

Those are that:
 - PYTHON=python2 is passed to configure and make
 - scripts are either
   - run explicitly by python in the build tree
   - run from the installed location (because scripts are rewritten to
match what we build the C components with at install time. )

> On 12/12/2018 17:08, Alexander Bokovoy wrote:
> > It is more complex than that. PEP-0394 
> > (https://www.python.org/dev/peps/pep-0394/)
> > says, among other things:
> >
> > - If the python command is installed, it should invoke the same version
> > of Python as the python2 command
> didn't read that one :-)
> >
> > - One exception to this is scripts that are deliberately written to be
> > source compatible with both Python 2.x and 3.x. Such scripts may
> > continue to use python on their shebang line.
> yep thats what I mentioned because at the moment (and for at least 4.10) 
> we will afaics be in a compatible world, build deliverables though are a 
> different matter because they really are targetted at a specific python 
> version (there is also an ongoing discussion about whether there should 
> be blanket changing of shebangs everywhere to python3)

I think we should make the blanket change.  I don't think our use case
counts as source compatible scripts, given the dependency on the stuff
we build.

> >
> > - When packaging software that is source compatible with both versions,
> > distributions may change such python shebangs to python3. This ensures
> > software is used with the latest version of Python available, and it
> > can remove a dependency on Python 2.
> and again that is something I think we probably should be doing

Agreed, eg our 'make install' handling.

So, I think our next step is to merge 
https://gitlab.com/samba-team/samba/merge_requests/148
and
https://gitlab.com/samba-team/samba/merge_requests/149

and finish
https://gitlab.com/samba-team/samba/merge_requests/154

How do others feel?

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba





More information about the samba-technical mailing list