[master 7/30] Use the imp module directly (#1014220)

M4rtinK installerbot-noreply at redhat.com
Mon Jun 1 14:04:24 UTC 2015


From: Martin Kolman <mkolman at redhat.com>

Imputils does not publicly provide the imp module
and also does not exist anymore in Python 3.
Importing imp directly should work fine in both Python 2 and 3.
---
 pyanaconda/installclass.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 86a0e23..d316db0 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -23,7 +23,7 @@
 
 from distutils.sysconfig import get_python_lib
 import os, sys
-import imputil
+import imp
 
 from blivet.partspec import PartSpec
 from blivet.autopart import swapSuggestion
@@ -195,13 +195,13 @@ def _ordering(first, second):
         done[mainName] = 1
 
         try:
-            found = imputil.imp.find_module(mainName)
+            found = imp.find_module(mainName)
         except ImportError:
             log.warning("module import of %s failed: %s", mainName, sys.exc_info()[0])
             continue
 
         try:
-            loaded = imputil.imp.load_module(mainName, found[0], found[1], found[2])
+            loaded = imp.load_module(mainName, found[0], found[1], found[2])
 
             for (_key, obj) in loaded.__dict__.items():
                 # If it's got these two methods, it's an InstallClass.


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/a91d39d2e0826ad22796885843cbec72344dcfd5


More information about the anaconda-patches mailing list