Revision 5b801534 image_creator/__init__.py

b/image_creator/__init__.py
33 33

  
34 34
__version__ = '0.1'
35 35

  
36

  
37
import image_creator.os_type
38

  
39

  
40
def get_os_class(distro, osfamily):
41
    module = None
42
    classname = None
43
    try:
44
        module = __import__("image_creator.os_type.%s"
45
            % distro, fromlist=['image_creator.os_type'])
46
        classname = distro.capitalize()
47
    except ImportError:
48
        module = __import__("image_creator.os_type.%s"
49
            % osfamily, fromlist=['image_creator.os_type'])
50
        classname = osfamily.capitalize()
51

  
52
    return getattr(module, classname)
53

  
54

  
55

  
56 36
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff