Revision 5b801534 image_creator/os_type/__init__.py
b/image_creator/os_type/__init__.py | ||
---|---|---|
37 | 37 |
import re |
38 | 38 |
|
39 | 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 |
|
|
40 | 55 |
def add_prefix(target): |
41 | 56 |
def wrapper(self, *args): |
42 | 57 |
prefix = args[0] |
Also available in: Unified diff