diff options
author | Chris Lumens <clumens@redhat.com> | 2007-02-26 18:15:34 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2007-02-26 18:15:34 +0000 |
commit | 6ad9d615b350d3698abb677d43633de1c0079f7d (patch) | |
tree | 4b8f8e2b54b814ecaab6f5b38dadbc340d0ec54d /installclass.py | |
parent | 7e617e054975936a722dfaebbad3939a59d9d7e5 (diff) | |
download | anaconda-6ad9d615b350d3698abb677d43633de1c0079f7d.tar.gz anaconda-6ad9d615b350d3698abb677d43633de1c0079f7d.tar.xz anaconda-6ad9d615b350d3698abb677d43633de1c0079f7d.zip |
Use imputil instead of exec.
Diffstat (limited to 'installclass.py')
-rw-r--r-- | installclass.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/installclass.py b/installclass.py index f5aaa5685..d10ba3640 100644 --- a/installclass.py +++ b/installclass.py @@ -18,6 +18,7 @@ import os, sys, iutil import string import language import rhpl +import imputil from instdata import InstallData from partitioning import * @@ -225,16 +226,6 @@ class BaseInstallClass: def setKeyboard(self, id, kb): id.keyboard.set(kb) - # activate the keyboard changes -# id.keyboard.activate() - - # XXX - #apply (todo.x.setKeyboard, xkb) - - ## hack - apply to instclass preset if present as well - #if (todo.instClass.x): - #apply (todo.instClass.x.setKeyboard, xkb) - def setHostname(self, id, hostname, override = 0): id.network.setHostname(hostname); id.network.overrideDHCPhostname = override @@ -513,11 +504,17 @@ def availableClasses(showHidden=0): if done.has_key(mainName): continue done[mainName] = 1 - obj = None - cmd = "import %s\nif %s.__dict__.has_key('InstallClass'): obj = %s.InstallClass\n" % (mainName, mainName, mainName) - exec(cmd) + try: + found = imputil.imp.find_module(mainName) + except: + log.warning ("module import of %s failed: %s" % (mainName, sys.exc_type)) + continue + + try: + loaded = imputil.imp.load_module(mainName, found[0], found[1], found[2]) + + obj = loaded.InstallClass - if obj: if obj.__dict__.has_key('sortPriority'): sortOrder = obj.sortPriority else: @@ -529,6 +526,8 @@ def availableClasses(showHidden=0): if obj.hidden == 0 or showHidden == 1: list.append(((obj.name, obj, obj.pixmap), sortOrder)) + except: + pass list.sort(ordering) for (item, priority) in list: |