build: only support python3 binary

python2 will be end of life by the time of the next
libvirt release. All our supported build targets, including
CentOS7, have a python3 build available.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-12-03 16:29:12 +00:00
parent bba1ec3d37
commit f0b3840fb6
21 changed files with 22 additions and 73 deletions

View File

@ -701,9 +701,9 @@ if test "$with_linux" = "yes"; then
fi
dnl Allow perl/python overrides
AC_PATH_PROGS([PYTHON], [python3 python2 python])
AC_PATH_PROGS([PYTHON], [python3])
if test -z "$PYTHON"; then
AC_MSG_ERROR(['python3', 'python2' or 'python' binary is required to build libvirt])
AC_MSG_ERROR(['python3' binary is required to build libvirt])
fi
AC_PATH_PROG([FLAKE8], [flake8])
if test -z "$FLAKE8"; then

View File

@ -188,14 +188,6 @@
%define with_bash_completion 0%{!?_without_bash_completion:1}
# 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}
# numad is used to manage the CPU and memory placement dynamically,
# it's not available on many non-x86 architectures.
@ -281,7 +273,7 @@ BuildRequires: perl-interpreter
%else
BuildRequires: perl
%endif
BuildRequires: %{python}
BuildRequires: python3
BuildRequires: systemd-units
%if %{with_libxl}
BuildRequires: xen-devel

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# This is the API builder, it parses the C sources and build the
# API formal description in XML.
@ -8,8 +8,6 @@
# daniel@veillard.com
#
from __future__ import print_function
import os
import sys
import glob

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2012-2019 Red Hat, Inc.
#
@ -19,8 +19,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2013-2019 Red Hat, Inc.
#
@ -21,8 +21,6 @@
# a lot of auto-generation of code, so when these don't match
# problems occur, preventing auth from succeeding at all.
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2013-2019 Red Hat, Inc.
#
@ -32,8 +32,6 @@
# detected EnsureACL call recorded.
#
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2013-2019 Red Hat, Inc.
#
@ -17,8 +17,6 @@
# <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2013-2019 Red Hat, Inc.
#
@ -17,8 +17,6 @@
# <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2012-2019 Red Hat, Inc.
#
@ -16,8 +16,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import re
import subprocess
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) 2012-2019 Red Hat, Inc.
#
@ -16,8 +16,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import os.path
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2011-2019 Red Hat, Inc.
#
@ -23,8 +23,6 @@
# python dtrace2systemtap.py probes.d > libvirt_probes.stp
#
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# esx_vi_generator.py: generates most of the SOAP type mapping code
@ -22,8 +22,6 @@
# <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import sys
import os
import os.path

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2012-2019 Red Hat, Inc.
#
@ -17,8 +17,6 @@
# <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2011-2019 Red Hat, Inc.
#
@ -22,8 +22,6 @@
# python gensystemtap.py */*.x > libvirt_functions.stp
#
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2018-2019 Red Hat, Inc.
#
@ -44,8 +44,6 @@
# ....content....
# #endif /* SYMBOL */
from __future__ import print_function
import os.path
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# hyperv_wmi_generator.py: generates most of the WMI type mapping code
@ -20,8 +20,6 @@
# <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import sys
import os
import os.path

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2018-2019 Red Hat, Inc.
#
@ -16,8 +16,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2017-2019 Red Hat, Inc.
#
@ -16,8 +16,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2016-2019 Red Hat, Inc.
#
@ -16,8 +16,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import re
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# reformat-news.py: Reformat the NEWS file properly
#
@ -18,8 +18,6 @@
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from __future__ import print_function
import sys
COLUMNS = 80

View File

@ -9,9 +9,7 @@ grep 'model name' /proc/cpuinfo | head -n1
cpuid -1r
echo
for python in python3 python2; do
$python <<EOF
from __future__ import print_function
python3 <<EOF
from struct import pack, unpack
from fcntl import ioctl
import sys, errno
@ -51,11 +49,6 @@ except IOError as e:
pass
EOF
if [[ $? -eq 0 ]]; then
break
fi
done
qemu=qemu-system-x86_64
for cmd in /usr/bin/$qemu /usr/bin/qemu-kvm /usr/libexec/qemu-kvm; do
if [[ -x $cmd ]]; then