[PATCH 02/11] build: drop support for python2, requiring python3 only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Meson requires python 3 and python 2 is end of life at
the end of the year.

This is the bare minimum cleanup which simply drops any
"from __future__" usage and updates the shbang line.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 configure.ac                       | 4 ++--
 docs/apibuild.py                   | 4 +---
 docs/reformat-news.py              | 4 +---
 libvirt.spec.in                    | 9 +--------
 src/esx/esx_vi_generator.py        | 4 +---
 src/hyperv/hyperv_wmi_generator.py | 4 +---
 tests/cputestdata/cpu-gather.sh    | 9 +--------
 7 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2855d8cab0..f5c6fabc6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -706,9 +706,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/docs/apibuild.py b/docs/apibuild.py
index 92886e1276..0242ff81be 100755
--- a/docs/apibuild.py
+++ b/docs/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@xxxxxxxxxxxx
 #
 
-from __future__ import print_function
-
 import os
 import sys
 import glob
diff --git a/docs/reformat-news.py b/docs/reformat-news.py
index 955ce2d45b..c2dfc138bc 100755
--- a/docs/reformat-news.py
+++ b/docs/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
 # <http://www.gnu.org/licenses/>.
 
-from __future__ import print_function
-
 import sys
 
 COLUMNS = 80
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 29839fad77..20d4c0444b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -175,13 +175,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,
@@ -268,7 +261,7 @@ BuildRequires: perl-interpreter
 %else
 BuildRequires: perl
 %endif
-BuildRequires: %{python}
+BuildRequires: python3
 BuildRequires: systemd-units
 %if %{with_libxl}
 BuildRequires: xen-devel
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 28d440a6df..1be42210ff 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/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 @@
 # <http://www.gnu.org/licenses/>.
 #
 
-from __future__ import print_function
-
 import sys
 import os
 import os.path
diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py
index a9ece0ff00..d12d15d012 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/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 @@
 # <http://www.gnu.org/licenses/>.
 #
 
-from __future__ import print_function
-
 import sys
 import os
 import os.path
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 <<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
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux