[dpdk-dev] [PATCH 0/9] python2 deprecation notice

Bruce Richardson bruce.richardson at intel.com
Fri Jul 17 14:42:09 CEST 2020


On Thu, Jul 16, 2020 at 02:01:21PM -0700, Stephen Hemminger wrote:
> On Thu, 16 Jul 2020 16:44:29 +0200
> Robin Jarry <robin.jarry at 6wind.com> wrote:
> 
> > 2020-07-13, Bruce Richardson:
> > > In the absense of a "proper" solution, is the simplest option to
> > > change the shebangs to all be python3, but leave the python2
> > > compatibility in place, and add the warnings for anyone running it
> > > explicitly using python2?   
> > 
> > I have found a hacky[1] but somewhat not too ugly way to dynamically use
> > any available python interpreter.
> > 
> > Basically, the scripts shebangs become:
> > 
> >  #!/bin/sh
> >  # shell script hack to dynamically use any available python interpreter
> >  ''':'
> >  if command -pv python3 >/dev/null 2>&1; then
> >    exec python3 "$0" "$@"
> >  else
> >    exec python2 "$0" "$@"
> >  fi
> >  '''
> >  # real python code starts here
> > 
> > This hack obviously would remain only for the time where we still have
> > python 2 support and can be removed after 20.08 is released.
> > 
> > What do you think?
> > 
> > [1] https://unix.stackexchange.com/a/66242
> > 
> 
> No.

I could live with this, but I think that python3 is widespread enough now
to just go with the simpler solution of python3 by default while still
allowing others to run with python2 explicitly if they so desire.

I think we have covered a number of options, but I'm not sure we have
converged on an agreed solution. Here are the options I would consider:

0. Do nothing to the code, and just print deprecation notice in docs. This
  will violate the previously documented plan, but won't break anything for
  anyone.
1. Just add deprecation notice but leave shebang lines unchanged, meaning
  lots of people see the notice but don't need to care since they just call
  the script.
2. As #1, but check if python3 is available and only print deprecation
  notice if not
3. Add deprecation notice, and change shebang lines to use python3. This
  means that anyone who does not have python3 installed will see a breaking
  change
4. Change shebangs to use python3 and detect at "make" build time if
  python3 is available. If py3 is unavailable, adjust shebang and add
  deprecation warning on "make install".
5. Use shell-hack above.

Any other options I'm missing?

For me, I think I can live with all options bar #1. Probably my top
preference would be #4 or #2, with #0 and #4 next best thereafter.

Regards,
/Bruce


More information about the dev mailing list