[OE-core] [PATCH] python: make python2 and python3 alternatives to python

Dmitry Rozhkov dmitry.rozhkov at linux.intel.com
Tue Apr 18 08:44:31 UTC 2017


On Thu, 2017-04-13 at 15:47 +0100, Burton, Ross wrote:
> 
> On 13 April 2017 at 11:15, Alexander Kanavin <alexander.kanavin at linux
> .intel.com> wrote:
> > This runs against upstream recommendation and common distro
> > practice. And it will break scripts that have not been ported to
> > Python 3. Please fix the scripts instead to refer to python 3
> > whenever possible.
> > 
> 
> Agreed.  If a script uses /usr/bin/python and gets py3, 99% of the
> time you'll get errors.

I've just checked PEP-349. It recommends that

"- The more general python command should be installed whenever any
version of Python 2 is installed and should invoke the same version of
Python as the python2 command (however, note that some distributions
have already chosen to have python implement the python3 command; see
the Rationale and Migration Notes below)."

The proposed patch doesn't violate this recommendation, because
"whenever" Python 2 is installed the python command still invokes
python2.

Also, there are other recommendations like

"- In order to tolerate differences across platforms, all new code that
needs to invoke the Python interpreter should not specify python , but
rather should specify either python2 or python3 (or the more specific
python2.x and python3.x versions; see the Migration Notes ). This
distinction should be made in shebangs, when invoking from a shell
script, when invoking via the system() call, or when invoking in any
other context.
- 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 without affecting their
portability."

If I understood correctly OE-core is not a distribution, but a tool to
create "a custom one". I would rather allow people to create
distributions where python3 is the default like in Arch Linux.

BR,
Dmitry



More information about the Openembedded-core mailing list