Move all *_target.py modules under modules/catalyst/target and create parent catalyst...
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 01:17:54 +0000 (19:17 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 01:17:54 +0000 (19:17 -0600)
16 files changed:
ChangeLog
modules/catalyst/target/__init__.py [new file with mode: 0644]
modules/catalyst/target/embedded_target.py [moved from modules/embedded_target.py with 100% similarity]
modules/catalyst/target/generic_stage_target.py [moved from modules/generic_stage_target.py with 100% similarity]
modules/catalyst/target/generic_target.py [moved from modules/generic_target.py with 100% similarity]
modules/catalyst/target/grp_target.py [moved from modules/grp_target.py with 100% similarity]
modules/catalyst/target/livecd_stage1_target.py [moved from modules/livecd_stage1_target.py with 100% similarity]
modules/catalyst/target/livecd_stage2_target.py [moved from modules/livecd_stage2_target.py with 100% similarity]
modules/catalyst/target/netboot2_target.py [moved from modules/netboot2_target.py with 100% similarity]
modules/catalyst/target/netboot_target.py [moved from modules/netboot_target.py with 100% similarity]
modules/catalyst/target/snapshot_target.py [moved from modules/snapshot_target.py with 100% similarity]
modules/catalyst/target/stage1_target.py [moved from modules/stage1_target.py with 100% similarity]
modules/catalyst/target/stage2_target.py [moved from modules/stage2_target.py with 100% similarity]
modules/catalyst/target/stage3_target.py [moved from modules/stage3_target.py with 100% similarity]
modules/catalyst/target/stage4_target.py [moved from modules/stage4_target.py with 100% similarity]
modules/catalyst/target/tinderbox_target.py [moved from modules/tinderbox_target.py with 100% similarity]

index 3e2f6c58a793d2b83d46e1d2c3edffa1c9a171d5..7cab21fce58d2e90a19e64ad2c92d5f5f86c052f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,32 @@
 # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
 # Distributed under the GPL v2
 
+  11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+  +modules/catalyst/target/__init__.py,
+  +modules/catalyst/target/embedded_target.py,
+  +modules/catalyst/target/generic_stage_target.py,
+  +modules/catalyst/target/generic_target.py,
+  +modules/catalyst/target/grp_target.py,
+  +modules/catalyst/target/livecd_stage1_target.py,
+  +modules/catalyst/target/livecd_stage2_target.py,
+  +modules/catalyst/target/netboot2_target.py,
+  +modules/catalyst/target/netboot_target.py,
+  +modules/catalyst/target/snapshot_target.py,
+  +modules/catalyst/target/stage1_target.py,
+  +modules/catalyst/target/stage2_target.py,
+  +modules/catalyst/target/stage3_target.py,
+  +modules/catalyst/target/stage4_target.py,
+  +modules/catalyst/target/tinderbox_target.py, -modules/embedded_target.py,
+  -modules/generic_stage_target.py, -modules/generic_target.py,
+  -modules/grp_target.py, -modules/livecd_stage1_target.py,
+  -modules/livecd_stage2_target.py, -modules/netboot2_target.py,
+  -modules/netboot_target.py, -modules/snapshot_target.py,
+  -modules/stage1_target.py, -modules/stage2_target.py,
+  -modules/stage3_target.py, -modules/stage4_target.py,
+  -modules/tinderbox_target.py:
+  Move all *_target.py modules under modules/catalyst/target and create
+  parent catalyst.target module
+
   11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst/arch/__init__.py, modules/catalyst/arch/arm.py:
   Remove hard-coded arch list now that find_arch_modules() is known to work
diff --git a/modules/catalyst/target/__init__.py b/modules/catalyst/target/__init__.py
new file mode 100644 (file)
index 0000000..99e1a7f
--- /dev/null
@@ -0,0 +1,30 @@
+"""
+Parent module of all target modules
+"""
+
+import os
+import imp
+import catalyst.util
+
+# This is only until we move all the output stuff into catalyst.output
+from catalyst_support import msg
+
+class targets:
+
+       def __init__(self):
+               self._target_modules = {}
+
+       def find_target_modules(self):
+               search_dir = os.path.abspath(os.path.dirname(__file__))
+               target_module_list = [x[:-3] for x in os.listdir(search_dir) \
+                       if x.endswith('.py') and not x.startswith('__')]
+               return target_module_list
+
+       def get_targets(self):
+               for x in self.find_target_modules():
+                       self._target_modules[x] = catalyst.util.load_module("catalyst.target." + x)
+                       if self._target_modules[x] is None:
+                               msg("Cannot import catalyst.target." + x + ". This usually only " + \
+                                       "happens due to a syntax error, which should be reported as " \
+                                       "a bug.")
+               return self._target_modules