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

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

 



All platforms we care about have Python 3 available.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 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@xxxxxxxxxx>
@@ -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





[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