[libvirt] [PATCH 0/4] python3: Finishing touches

import blurb Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'blurb'
Andrea Bolognani (4): configure: Allow (and prefer) Python 3 spec: Use Python 3 for building on Fedora mingw: Use Python 3 for building news: Update for Python 3 compatibility configure.ac | 4 ++-- docs/news.xml | 11 +++++++++++ libvirt.spec.in | 9 ++++++++- mingw-libvirt.spec.in | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) -- 2.14.3

Our build process no longer depends on Python 2, so we can finally allow Python 3 to satisfy our requirement for a Python interpreter. Since several distributions have now switched to installing Python 3 by default and Python 2 is on its way out, prefer the former when both are available. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 970a695ad1..56a7ad780a 100644 --- a/configure.ac +++ b/configure.ac @@ -645,9 +645,9 @@ if test "$with_linux" = "yes"; then fi dnl Allow perl/python overrides -AC_PATH_PROGS([PYTHON], [python2 python]) +AC_PATH_PROGS([PYTHON], [python3 python2 python]) if test -z "$PYTHON"; then - AC_MSG_ERROR(['python' or 'python2' binary is required to build libvirt]) + AC_MSG_ERROR(['python3', 'python2' or 'python' binary is required to build libvirt]) fi AC_PATH_PROG([PERL], [perl]) if test -z "$PERL"; then -- 2.14.3

On Tue, Mar 20, 2018 at 11:53:52AM +0100, Andrea Bolognani wrote:
Our build process no longer depends on Python 2, so we can finally allow Python 3 to satisfy our requirement for a Python interpreter.
Since several distributions have now switched to installing Python 3 by default and Python 2 is on its way out, prefer the former when both are available.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
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 :|

While RHEL / CentOS are still using Python 2 for the time being, Fedora has already switched to Python 3 as the default Python interpreter a while ago, so on that OS it doesn't make sense to drag in Python 2 anymore. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- libvirt.spec.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index bc8257f34b..3994fdf901 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -202,6 +202,13 @@ %define with_bash_completion 0%{!?_without_bash_completion:1} %endif +# Fedora can use Python 3, which unlike Python 2 is installed by default +%if 0%{?fedora} + %define python python3 +%else + %define python python2 +%endif + %if %{with_qemu} || %{with_lxc} || %{with_uml} # numad is used to manage the CPU and memory placement dynamically, @@ -305,7 +312,7 @@ BuildRequires: perl-interpreter %else BuildRequires: perl %endif -BuildRequires: python2 +BuildRequires: %{python} %if %{with_systemd} BuildRequires: systemd-units %endif -- 2.14.3

On Tue, Mar 20, 2018 at 11:53:53AM +0100, Andrea Bolognani wrote:
While RHEL / CentOS are still using Python 2 for the time being, Fedora has already switched to Python 3 as the default Python interpreter a while ago, so on that OS it doesn't make sense to drag in Python 2 anymore.
While current RHEL are py2, future RHEL should be expected to use Python 3 too
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- libvirt.spec.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index bc8257f34b..3994fdf901 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -202,6 +202,13 @@ %define with_bash_completion 0%{!?_without_bash_completion:1} %endif
+# Fedora can use Python 3, which unlike Python 2 is installed by default +%if 0%{?fedora}
This should include "|| 0%{?rhel} > 7" too
+ %define python python3 +%else + %define python python2 +%endif +
%if %{with_qemu} || %{with_lxc} || %{with_uml} # numad is used to manage the CPU and memory placement dynamically, @@ -305,7 +312,7 @@ BuildRequires: perl-interpreter %else BuildRequires: perl %endif -BuildRequires: python2 +BuildRequires: %{python} %if %{with_systemd} BuildRequires: systemd-units %endif -- 2.14.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
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 Tue, 2018-03-20 at 11:12 +0000, Daniel P. Berrangé wrote:
On Tue, Mar 20, 2018 at 11:53:53AM +0100, Andrea Bolognani wrote:
While RHEL / CentOS are still using Python 2 for the time being, Fedora has already switched to Python 3 as the default Python interpreter a while ago, so on that OS it doesn't make sense to drag in Python 2 anymore.
While current RHEL are py2, future RHEL should be expected to use Python 3 too
[...]
+# Fedora can use Python 3, which unlike Python 2 is installed by default +%if 0%{?fedora}
This should include "|| 0%{?rhel} > 7" too
I think we should cross that bridge when we come to it, eg. when a RHEL release that uses Python 3 as the default Python is released. We're probably going to have to go through the spec file and reassess most package relationships at that point anyway. -- Andrea Bolognani / Red Hat / Virtualization

On Tue, Mar 20, 2018 at 01:38:50PM +0100, Andrea Bolognani wrote:
On Tue, 2018-03-20 at 11:12 +0000, Daniel P. Berrangé wrote:
On Tue, Mar 20, 2018 at 11:53:53AM +0100, Andrea Bolognani wrote:
While RHEL / CentOS are still using Python 2 for the time being, Fedora has already switched to Python 3 as the default Python interpreter a while ago, so on that OS it doesn't make sense to drag in Python 2 anymore.
While current RHEL are py2, future RHEL should be expected to use Python 3 too
[...]
+# Fedora can use Python 3, which unlike Python 2 is installed by default +%if 0%{?fedora}
This should include "|| 0%{?rhel} > 7" too
I think we should cross that bridge when we come to it, eg. when a RHEL release that uses Python 3 as the default Python is released.
We're probably going to have to go through the spec file and reassess most package relationships at that point anyway.
We've already crossed the bridge & done this work commit b2ab38bfdc765bbcb56b89b55dfee6b406fc8c29 Author: Jiri Denemark <jdenemar@redhat.com> Date: Fri Feb 9 14:08:45 2018 +0100 spec: Prepare for future RHEL 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 Tue, 2018-03-20 at 12:40 +0000, Daniel P. Berrangé wrote:
On Tue, Mar 20, 2018 at 01:38:50PM +0100, Andrea Bolognani wrote:
On Tue, 2018-03-20 at 11:12 +0000, Daniel P. Berrangé wrote:
While current RHEL are py2, future RHEL should be expected to use Python 3 too
[...] I think we should cross that bridge when we come to it, eg. when a RHEL release that uses Python 3 as the default Python is released.
We're probably going to have to go through the spec file and reassess most package relationships at that point anyway.
We've already crossed the bridge & done this work
commit b2ab38bfdc765bbcb56b89b55dfee6b406fc8c29 Author: Jiri Denemark <jdenemar@redhat.com> Date: Fri Feb 9 14:08:45 2018 +0100
spec: Prepare for future RHEL
Fair enough, I must have missed that. Do you want me to post a v2 of the patch, or can I adjust the %if condition as suggested (along with the comment) and add your R-b? -- Andrea Bolognani / Red Hat / Virtualization

On Tue, Mar 20, 2018 at 01:46:43PM +0100, Andrea Bolognani wrote:
On Tue, 2018-03-20 at 12:40 +0000, Daniel P. Berrangé wrote:
On Tue, Mar 20, 2018 at 01:38:50PM +0100, Andrea Bolognani wrote:
On Tue, 2018-03-20 at 11:12 +0000, Daniel P. Berrangé wrote:
While current RHEL are py2, future RHEL should be expected to use Python 3 too
[...] I think we should cross that bridge when we come to it, eg. when a RHEL release that uses Python 3 as the default Python is released.
We're probably going to have to go through the spec file and reassess most package relationships at that point anyway.
We've already crossed the bridge & done this work
commit b2ab38bfdc765bbcb56b89b55dfee6b406fc8c29 Author: Jiri Denemark <jdenemar@redhat.com> Date: Fri Feb 9 14:08:45 2018 +0100
spec: Prepare for future RHEL
Fair enough, I must have missed that.
Do you want me to post a v2 of the patch, or can I adjust the %if condition as suggested (along with the comment) and add your R-b?
Sure, feel free to push make the suggested change & have my R-b 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 :|

While RHEL / CentOS are still using Python 2 for the time being, Fedora has already switched to Python 3 as the default Python interpreter a while ago, so on that OS it doesn't make sense to drag in Python 2 anymore. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- mingw-libvirt.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index 8f3f26d2d9..917d2143d8 100644 --- a/mingw-libvirt.spec.in +++ b/mingw-libvirt.spec.in @@ -72,7 +72,7 @@ BuildRequires: pkgconfig # Need native version for msgfmt BuildRequires: gettext BuildRequires: libxslt -BuildRequires: python2 +BuildRequires: python3 %if 0%{?fedora} >= 27 BuildRequires: perl-interpreter %else -- 2.14.3

On Tue, Mar 20, 2018 at 11:53:54AM +0100, Andrea Bolognani wrote:
While RHEL / CentOS are still using Python 2 for the time being, Fedora has already switched to Python 3 as the default Python interpreter a while ago, so on that OS it doesn't make sense to drag in Python 2 anymore.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- mingw-libvirt.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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 :|

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/news.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 6d729d5085..75a0543084 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,17 @@ <libvirt> <release version="v4.2.0" date="unreleased"> <section title="New features"> + <change> + <summary> + Support building with Python 3 + </summary> + <description> + Python is required to build libvirt, and up until now only Python 2 + could be used as an interpreter. All scripts used during build have + now been made compatible with Python 3, which means both major + releases of the language are fully supported. + </description> + </change> </section> <section title="Improvements"> <change> -- 2.14.3

On Tue, Mar 20, 2018 at 11:53:55AM +0100, Andrea Bolognani wrote:
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/news.xml | 11 +++++++++++ 1 file changed, 11 insertions(+)
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 :|
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrangé