From f0b3840fb654289c774df1fa13f3cb6f901ade61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 3 Dec 2019 16:29:12 +0000 Subject: [PATCH] build: only support python3 binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é --- configure.ac | 4 ++-- libvirt.spec.in | 10 +--------- scripts/apibuild.py | 4 +--- scripts/augeas-gentest.py | 4 +--- scripts/check-aclperms.py | 4 +--- scripts/check-aclrules.py | 4 +--- scripts/check-driverimpls.py | 4 +--- scripts/check-drivername.py | 4 +--- scripts/check-symfile.py | 4 +--- scripts/check-symsorting.py | 4 +--- scripts/dtrace2systemtap.py | 4 +--- scripts/esx_vi_generator.py | 4 +--- scripts/genpolkit.py | 4 +--- scripts/gensystemtap.py | 4 +--- scripts/header-ifdef.py | 4 +--- scripts/hyperv_wmi_generator.py | 4 +--- scripts/minimize-po.py | 4 +--- scripts/mock-noinline.py | 4 +--- scripts/prohibit-duplicate-header.py | 4 +--- scripts/reformat-news.py | 4 +--- tests/cputestdata/cpu-gather.sh | 9 +-------- 21 files changed, 22 insertions(+), 73 deletions(-) diff --git a/configure.ac b/configure.ac index 76d28d2f67..2e5af075ea 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/libvirt.spec.in b/libvirt.spec.in index 4c6161a26f..72ed2fd96b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -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 diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 5a0224c1c6..2f7314b379 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -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 diff --git a/scripts/augeas-gentest.py b/scripts/augeas-gentest.py index 60e12fb77e..8976785cad 100755 --- a/scripts/augeas-gentest.py +++ b/scripts/augeas-gentest.py @@ -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 # . -from __future__ import print_function - import re import sys diff --git a/scripts/check-aclperms.py b/scripts/check-aclperms.py index b1084a3758..67de0efabd 100755 --- a/scripts/check-aclperms.py +++ b/scripts/check-aclperms.py @@ -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 diff --git a/scripts/check-aclrules.py b/scripts/check-aclrules.py index 5a7d275410..a1fa473174 100755 --- a/scripts/check-aclrules.py +++ b/scripts/check-aclrules.py @@ -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 diff --git a/scripts/check-driverimpls.py b/scripts/check-driverimpls.py index bc3f16a816..8289b8051e 100755 --- a/scripts/check-driverimpls.py +++ b/scripts/check-driverimpls.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2013-2019 Red Hat, Inc. # @@ -17,8 +17,6 @@ # . # -from __future__ import print_function - import re import sys diff --git a/scripts/check-drivername.py b/scripts/check-drivername.py index ba77a6d48d..39eff836c7 100644 --- a/scripts/check-drivername.py +++ b/scripts/check-drivername.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2013-2019 Red Hat, Inc. # @@ -17,8 +17,6 @@ # . # -from __future__ import print_function - import re import sys diff --git a/scripts/check-symfile.py b/scripts/check-symfile.py index 7aeb047d89..0f6e780df0 100755 --- a/scripts/check-symfile.py +++ b/scripts/check-symfile.py @@ -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 # . -from __future__ import print_function - import re import subprocess import sys diff --git a/scripts/check-symsorting.py b/scripts/check-symsorting.py index 006c42f1b3..e5a69df20a 100755 --- a/scripts/check-symsorting.py +++ b/scripts/check-symsorting.py @@ -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 # . -from __future__ import print_function - import os.path import re import sys diff --git a/scripts/dtrace2systemtap.py b/scripts/dtrace2systemtap.py index d6bf1f8d1f..506db9c503 100755 --- a/scripts/dtrace2systemtap.py +++ b/scripts/dtrace2systemtap.py @@ -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 diff --git a/scripts/esx_vi_generator.py b/scripts/esx_vi_generator.py index 2f685c0898..048f5dde9e 100755 --- a/scripts/esx_vi_generator.py +++ b/scripts/esx_vi_generator.py @@ -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 @@ # . # -from __future__ import print_function - import sys import os import os.path diff --git a/scripts/genpolkit.py b/scripts/genpolkit.py index 230d920f70..8845ea44e0 100755 --- a/scripts/genpolkit.py +++ b/scripts/genpolkit.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2012-2019 Red Hat, Inc. # @@ -17,8 +17,6 @@ # . # -from __future__ import print_function - import re import sys diff --git a/scripts/gensystemtap.py b/scripts/gensystemtap.py index 7b391cc911..ad808e3033 100755 --- a/scripts/gensystemtap.py +++ b/scripts/gensystemtap.py @@ -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 diff --git a/scripts/header-ifdef.py b/scripts/header-ifdef.py index d5ec7b45fe..e668875f18 100644 --- a/scripts/header-ifdef.py +++ b/scripts/header-ifdef.py @@ -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 diff --git a/scripts/hyperv_wmi_generator.py b/scripts/hyperv_wmi_generator.py index 3001f222f7..736eabd598 100755 --- a/scripts/hyperv_wmi_generator.py +++ b/scripts/hyperv_wmi_generator.py @@ -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 @@ # . # -from __future__ import print_function - import sys import os import os.path diff --git a/scripts/minimize-po.py b/scripts/minimize-po.py index d548b427e9..c305229721 100755 --- a/scripts/minimize-po.py +++ b/scripts/minimize-po.py @@ -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 # . -from __future__ import print_function - import re import sys diff --git a/scripts/mock-noinline.py b/scripts/mock-noinline.py index b338c5f097..4fc60c0be3 100644 --- a/scripts/mock-noinline.py +++ b/scripts/mock-noinline.py @@ -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 # . -from __future__ import print_function - import re import sys diff --git a/scripts/prohibit-duplicate-header.py b/scripts/prohibit-duplicate-header.py index 420311ccef..33a91ddbc5 100644 --- a/scripts/prohibit-duplicate-header.py +++ b/scripts/prohibit-duplicate-header.py @@ -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 # . -from __future__ import print_function - import re import sys diff --git a/scripts/reformat-news.py b/scripts/reformat-news.py index a06f945c02..7bc752d821 100755 --- a/scripts/reformat-news.py +++ b/scripts/reformat-news.py @@ -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 # . -from __future__ import print_function - import sys COLUMNS = 80 diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh index cefd1b0d0d..79e3fddf22 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -9,9 +9,7 @@ grep 'model name' /proc/cpuinfo | head -n1 cpuid -1r echo -for python in python3 python2; do - $python <