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

Stephen Hemminger stephen at networkplumber.org
Thu Jul 16 23:01:21 CEST 2020


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.


More information about the dev mailing list