[libvirt-ci PATCH] lcitool: Make Python 3 only

Andrea Bolognani posted 1 patch 3 years, 11 months ago
Failed in applying to current master (apply log)
guests/lcitool | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
[libvirt-ci PATCH] lcitool: Make Python 3 only
Posted by Andrea Bolognani 3 years, 11 months ago
All platforms we care about have Python 3 available.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 guests/lcitool | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index ab3b95f..a30187b 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # lcitool - libvirt CI guest management tool
 # Copyright (C) 2017-2018  Andrea Bolognani <abologna@redhat.com>
@@ -17,6 +17,7 @@
 # with this program. If not, see <https://www.gnu.org/licenses/>.
 
 import argparse
+import configparser
 import distutils.spawn
 import fnmatch
 import json
@@ -31,12 +32,6 @@ import tempfile
 import textwrap
 import yaml
 
-# This is necessary to maintain Python 2.7 compatibility
-try:
-    from configparser import ConfigParser
-except ImportError:
-    from ConfigParser import SafeConfigParser as ConfigParser
-
 
 class Util:
 
@@ -263,7 +258,7 @@ class Inventory:
         ansible_cfg_path = os.path.join(base, "ansible.cfg")
 
         try:
-            parser = ConfigParser()
+            parser = configparser.ConfigParser()
             parser.read(ansible_cfg_path)
             inventory_path = parser.get("defaults", "inventory")
         except Exception as ex:
-- 
2.25.4

Re: [libvirt-ci PATCH] lcitool: Make Python 3 only
Posted by Erik Skultety 3 years, 11 months ago
On Thu, May 07, 2020 at 04:17:08PM +0200, Andrea Bolognani wrote:
> All platforms we care about have Python 3 available.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---

Planned to do it myself after finishing with the current stuff :), thank you.

Reviewed-by: Erik Skultety <eskultet@redhat.com>