diff --git a/libvirt.spec.in b/libvirt.spec.in index bc8257f34b29cf9f30724732b8387eb5c4becd55..d6e387951bec030ae083ac2fc31e9c3ea19a303b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -202,6 +202,13 @@ %define with_bash_completion 0%{!?_without_bash_completion:1} %endif +# Use Python 3 when possible, Python 2 otherwise +%if 0%{?fedora} || 0%{?rhel} > 7 + %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