From e098402bef78a84ceb214f43e7f852f7254f0b31 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sat, 10 Jan 2009 19:17:54 -0600 Subject: [PATCH] Move all *_target.py modules under modules/catalyst/target and create parent catalyst.target module --- ChangeLog | 26 ++++++++++++++++ modules/catalyst/target/__init__.py | 30 +++++++++++++++++++ .../{ => catalyst/target}/embedded_target.py | 0 .../target}/generic_stage_target.py | 0 .../{ => catalyst/target}/generic_target.py | 0 modules/{ => catalyst/target}/grp_target.py | 0 .../target}/livecd_stage1_target.py | 0 .../target}/livecd_stage2_target.py | 0 .../{ => catalyst/target}/netboot2_target.py | 0 .../{ => catalyst/target}/netboot_target.py | 0 .../{ => catalyst/target}/snapshot_target.py | 0 .../{ => catalyst/target}/stage1_target.py | 0 .../{ => catalyst/target}/stage2_target.py | 0 .../{ => catalyst/target}/stage3_target.py | 0 .../{ => catalyst/target}/stage4_target.py | 0 .../{ => catalyst/target}/tinderbox_target.py | 0 16 files changed, 56 insertions(+) create mode 100644 modules/catalyst/target/__init__.py rename modules/{ => catalyst/target}/embedded_target.py (100%) rename modules/{ => catalyst/target}/generic_stage_target.py (100%) rename modules/{ => catalyst/target}/generic_target.py (100%) rename modules/{ => catalyst/target}/grp_target.py (100%) rename modules/{ => catalyst/target}/livecd_stage1_target.py (100%) rename modules/{ => catalyst/target}/livecd_stage2_target.py (100%) rename modules/{ => catalyst/target}/netboot2_target.py (100%) rename modules/{ => catalyst/target}/netboot_target.py (100%) rename modules/{ => catalyst/target}/snapshot_target.py (100%) rename modules/{ => catalyst/target}/stage1_target.py (100%) rename modules/{ => catalyst/target}/stage2_target.py (100%) rename modules/{ => catalyst/target}/stage3_target.py (100%) rename modules/{ => catalyst/target}/stage4_target.py (100%) rename modules/{ => catalyst/target}/tinderbox_target.py (100%) diff --git a/ChangeLog b/ChangeLog index 3e2f6c58..7cab21fc 100644 --- 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 + +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 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 index 00000000..99e1a7fb --- /dev/null +++ b/modules/catalyst/target/__init__.py @@ -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 diff --git a/modules/embedded_target.py b/modules/catalyst/target/embedded_target.py similarity index 100% rename from modules/embedded_target.py rename to modules/catalyst/target/embedded_target.py diff --git a/modules/generic_stage_target.py b/modules/catalyst/target/generic_stage_target.py similarity index 100% rename from modules/generic_stage_target.py rename to modules/catalyst/target/generic_stage_target.py diff --git a/modules/generic_target.py b/modules/catalyst/target/generic_target.py similarity index 100% rename from modules/generic_target.py rename to modules/catalyst/target/generic_target.py diff --git a/modules/grp_target.py b/modules/catalyst/target/grp_target.py similarity index 100% rename from modules/grp_target.py rename to modules/catalyst/target/grp_target.py diff --git a/modules/livecd_stage1_target.py b/modules/catalyst/target/livecd_stage1_target.py similarity index 100% rename from modules/livecd_stage1_target.py rename to modules/catalyst/target/livecd_stage1_target.py diff --git a/modules/livecd_stage2_target.py b/modules/catalyst/target/livecd_stage2_target.py similarity index 100% rename from modules/livecd_stage2_target.py rename to modules/catalyst/target/livecd_stage2_target.py diff --git a/modules/netboot2_target.py b/modules/catalyst/target/netboot2_target.py similarity index 100% rename from modules/netboot2_target.py rename to modules/catalyst/target/netboot2_target.py diff --git a/modules/netboot_target.py b/modules/catalyst/target/netboot_target.py similarity index 100% rename from modules/netboot_target.py rename to modules/catalyst/target/netboot_target.py diff --git a/modules/snapshot_target.py b/modules/catalyst/target/snapshot_target.py similarity index 100% rename from modules/snapshot_target.py rename to modules/catalyst/target/snapshot_target.py diff --git a/modules/stage1_target.py b/modules/catalyst/target/stage1_target.py similarity index 100% rename from modules/stage1_target.py rename to modules/catalyst/target/stage1_target.py diff --git a/modules/stage2_target.py b/modules/catalyst/target/stage2_target.py similarity index 100% rename from modules/stage2_target.py rename to modules/catalyst/target/stage2_target.py diff --git a/modules/stage3_target.py b/modules/catalyst/target/stage3_target.py similarity index 100% rename from modules/stage3_target.py rename to modules/catalyst/target/stage3_target.py diff --git a/modules/stage4_target.py b/modules/catalyst/target/stage4_target.py similarity index 100% rename from modules/stage4_target.py rename to modules/catalyst/target/stage4_target.py diff --git a/modules/tinderbox_target.py b/modules/catalyst/target/tinderbox_target.py similarity index 100% rename from modules/tinderbox_target.py rename to modules/catalyst/target/tinderbox_target.py -- 2.26.2