ia64/xen-unstable

view tools/python/xen/util/xsm/xsm.py @ 18439:7d1eadfe4631

xsm: Fix __import__() usage on Python 2.4 and earlier.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Sep 04 11:55:48 2008 +0100 (2008-09-04)
parents 5b133625223a
children
line source
1 import sys
2 import string
3 from xen.xend import XendOptions
4 from xen.util import xsconstants
5 from xsm_core import xsm_init
7 xoptions = XendOptions.instance()
8 xsm_module_name = xoptions.get_xsm_module_name()
10 xsconstants.XS_POLICY_USE = eval("xsconstants.XS_POLICY_" +
11 string.upper(xsm_module_name))
13 xsm_module_path = "xen.util.xsm." + xsm_module_name + "." + xsm_module_name
14 xsm_module = __import__(xsm_module_path, globals(), locals(), ['*'])
16 xsm_init(xsm_module)
18 for op in dir(xsm_module):
19 if not hasattr(sys.modules[__name__], op):
20 setattr(sys.modules[__name__], op, getattr(xsm_module, op, None))