#!/usr/bin/python
import _fireinfo
+import system
class Hypervisor(object):
def __init__(self):
self.__info = _fireinfo.get_hypervisor()
+ @property
+ def system(self):
+ """
+ Return the current instance of the System class.
+
+ We need to do that as a property because otherwise
+ we get a recursion.
+ """
+ return system.System()
+
@property
def vendor(self):
"""
import device
import hypervisor
+class Singleton(type):
+ def __init__(cls, name, bases, dict):
+ super(Singleton, cls).__init__(name, bases, dict)
+ cls.instance = None
+
+ def __call__(cls, *args, **kw):
+ if cls.instance is None:
+ cls.instance = super(Singleton, cls).__call__(*args, **kw)
+
+ return cls.instance
+
+
class System(object):
+ __metaclass__ = Singleton
def __init__(self):
# find all devices