Message ID | 20181024194134.61884-1-raspl@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tools/kvm_stat: switch to python3 | expand |
On 24.10.18 21:41, Stefan Raspl wrote: > From: Stefan Raspl <stefan.raspl@de.ibm.com> > > The current shebang does not work in environments that only support python3 > and have no python2 installed. Plus there does not seem to be a way to > support python2 and python3 at the same time. Since all known python3 issues > were fixed, and as python3 is the way to go, let's switch over. > Note that the code is still python2 compliant, so folks in bad use can > simply revert the shebang. > > Suggested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com> > Signed-off-by: Stefan Raspl <raspl@linux.ibm.com> > --- > tools/kvm/kvm_stat/kvm_stat | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat > index 195ba486640f..2ed395b817cb 100755 > --- a/tools/kvm/kvm_stat/kvm_stat > +++ b/tools/kvm/kvm_stat/kvm_stat > @@ -1,4 +1,4 @@ > -#!/usr/bin/python > +#!/usr/bin/env python3 > # > # top-like utility for displaying kvm statistics > # > Any thoughts on this? Ciao, Stefan
On 24/10/18 21:41, Stefan Raspl wrote: > From: Stefan Raspl <stefan.raspl@de.ibm.com> > > The current shebang does not work in environments that only support python3 > and have no python2 installed. Plus there does not seem to be a way to > support python2 and python3 at the same time. Since all known python3 issues > were fixed, and as python3 is the way to go, let's switch over. > Note that the code is still python2 compliant, so folks in bad use can > simply revert the shebang. Sure, but why not /usr/bin/python3? Paolo > Suggested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com> > Signed-off-by: Stefan Raspl <raspl@linux.ibm.com> > --- > tools/kvm/kvm_stat/kvm_stat | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat > index 195ba486640f..2ed395b817cb 100755 > --- a/tools/kvm/kvm_stat/kvm_stat > +++ b/tools/kvm/kvm_stat/kvm_stat > @@ -1,4 +1,4 @@ > -#!/usr/bin/python > +#!/usr/bin/env python3 > # > # top-like utility for displaying kvm statistics > # >
On 25.11.18 18:57, Paolo Bonzini wrote: > On 24/10/18 21:41, Stefan Raspl wrote: >> From: Stefan Raspl <stefan.raspl@de.ibm.com> >> >> The current shebang does not work in environments that only support python3 >> and have no python2 installed. Plus there does not seem to be a way to >> support python2 and python3 at the same time. Since all known python3 issues >> were fixed, and as python3 is the way to go, let's switch over. >> Note that the code is still python2 compliant, so folks in bad use can >> simply revert the shebang. > > Sure, but why not /usr/bin/python3? Picked this up as good practice - according to https://stackoverflow.com/questions/2429511/why-do-people-write-the-usr-bin-env-python-shebang-on-the-first-line-of-a-pyt/2429517 : "If you have several versions of Python installed, /usr/bin/env will ensure the interpreter used is the first one on your environment's $PATH. The alternative would be to hardcode something like #!/usr/bin/python; that's ok, but less flexible." Ciao, Stefan
On 26.11.18 14:46, Stefan Raspl wrote: > On 25.11.18 18:57, Paolo Bonzini wrote: >> On 24/10/18 21:41, Stefan Raspl wrote: >>> From: Stefan Raspl <stefan.raspl@de.ibm.com> >>> >>> The current shebang does not work in environments that only support python3 >>> and have no python2 installed. Plus there does not seem to be a way to >>> support python2 and python3 at the same time. Since all known python3 issues >>> were fixed, and as python3 is the way to go, let's switch over. >>> Note that the code is still python2 compliant, so folks in bad use can >>> simply revert the shebang. >> >> Sure, but why not /usr/bin/python3? > > Picked this up as good practice - according to > https://stackoverflow.com/questions/2429511/why-do-people-write-the-usr-bin-env-python-shebang-on-the-first-line-of-a-pyt/2429517 > : > > "If you have several versions of Python installed, /usr/bin/env will ensure the > interpreter used is the first one on your environment's $PATH. The alternative > would be to hardcode something like #!/usr/bin/python; that's ok, but less > flexible." *ping* Ciao, Stefan
On 14/12/18 10:35, Stefan Raspl wrote: > On 26.11.18 14:46, Stefan Raspl wrote: >> On 25.11.18 18:57, Paolo Bonzini wrote: >>> On 24/10/18 21:41, Stefan Raspl wrote: >>>> From: Stefan Raspl <stefan.raspl@de.ibm.com> >>>> >>>> The current shebang does not work in environments that only support python3 >>>> and have no python2 installed. Plus there does not seem to be a way to >>>> support python2 and python3 at the same time. Since all known python3 issues >>>> were fixed, and as python3 is the way to go, let's switch over. >>>> Note that the code is still python2 compliant, so folks in bad use can >>>> simply revert the shebang. >>> >>> Sure, but why not /usr/bin/python3? >> >> Picked this up as good practice - according to >> https://stackoverflow.com/questions/2429511/why-do-people-write-the-usr-bin-env-python-shebang-on-the-first-line-of-a-pyt/2429517 >> : >> >> "If you have several versions of Python installed, /usr/bin/env will ensure the >> interpreter used is the first one on your environment's $PATH. The alternative >> would be to hardcode something like #!/usr/bin/python; that's ok, but less >> flexible." > > *ping* It's queued, thanks. Paolo
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat index 195ba486640f..2ed395b817cb 100755 --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # top-like utility for displaying kvm statistics #