[libvirt] [PATCH 0/2] python3: Further minor tweaks

Andrea Bolognani (2): docs: Import print_function in reformat-news.py python: Drop explicit version where possible docs/reformat-news.py | 4 +++- src/esx/esx_vi_generator.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) -- 2.14.3

The script already works perfectly fine with Python 2, but that's more by chance than by design: we have a single occurrence of print(), and it just so happens that its only argument is an expression. Importing print_function makes the script more future, err, past proof. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/reformat-news.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/reformat-news.py b/docs/reformat-news.py index 89f7ccb3dc..fe08bf6d91 100755 --- a/docs/reformat-news.py +++ b/docs/reformat-news.py @@ -21,6 +21,8 @@ # Authors: # Andrea Bolognani <abologna@redhat.com> +from __future__ import print_function + import sys COLUMNS = 80 -- 2.14.3

On Thu, Mar 15, 2018 at 06:00:37PM +0100, Andrea Bolognani wrote:
The script already works perfectly fine with Python 2, but that's more by chance than by design: we have a single occurrence of print(), and it just so happens that its only argument is an expression. Importing print_function makes the script more future, err, past proof.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/reformat-news.py | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/docs/reformat-news.py b/docs/reformat-news.py index 89f7ccb3dc..fe08bf6d91 100755 --- a/docs/reformat-news.py +++ b/docs/reformat-news.py @@ -21,6 +21,8 @@ # Authors: # Andrea Bolognani <abologna@redhat.com>
+from __future__ import print_function + import sys
COLUMNS = 80
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Some of our scripts are known to work both with Python 2 and Python 3, so for them we shouldn't be forcing any specific version of the interpreter when they're called directly. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/reformat-news.py | 2 +- src/esx/esx_vi_generator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reformat-news.py b/docs/reformat-news.py index fe08bf6d91..d8726f1a1c 100755 --- a/docs/reformat-news.py +++ b/docs/reformat-news.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python # reformat-news.py: Reformat the NEWS file properly # diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 6ce017d794..545f8bdda3 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python # # esx_vi_generator.py: generates most of the SOAP type mapping code -- 2.14.3

On Thu, Mar 15, 2018 at 06:00:38PM +0100, Andrea Bolognani wrote:
Some of our scripts are known to work both with Python 2 and Python 3, so for them we shouldn't be forcing any specific version of the interpreter when they're called directly.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/reformat-news.py | 2 +- src/esx/esx_vi_generator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/reformat-news.py b/docs/reformat-news.py index fe08bf6d91..d8726f1a1c 100755 --- a/docs/reformat-news.py +++ b/docs/reformat-news.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python
# reformat-news.py: Reformat the NEWS file properly # diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 6ce017d794..545f8bdda3 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python
# # esx_vi_generator.py: generates most of the SOAP type mapping code
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Presumably we always invoke them with $(PYTHON) from make anyway Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Thu, 2018-03-15 at 17:07 +0000, Daniel P. Berrangé wrote:
On Thu, Mar 15, 2018 at 06:00:38PM +0100, Andrea Bolognani wrote:
Some of our scripts are known to work both with Python 2 and Python 3, so for them we shouldn't be forcing any specific version of the interpreter when they're called directly.
Presumably we always invoke them with $(PYTHON) from make anyway
Indeed. I've added a note about that to the commit message, and extended the diff to include more scripts now that Cole's Python 3 fixes have been merged. -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrangé