# 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/arch/__init__.py, modules/catalyst/target/__init__.py,
+ modules/catalyst/target/generic_stage.py:
+ Get rid of arches and targets classes and move functions into the module
+ instead
+
11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
targets/embedded/embedded-chroot.sh,
targets/embedded/embedded-controller.sh, targets/grp/grp-controller.sh,
# This is only until we move all the output stuff into catalyst.output
from catalyst.support import msg
-class arches:
-
- def __init__(self):
- self._arch_modules = {}
-
- def find_arch_modules(self):
- search_dir = os.path.abspath(os.path.dirname(__file__))
- arch_module_list = [x[:-3] for x in os.listdir(search_dir) \
- if x.endswith('.py') and not x.startswith('__')]
- return arch_module_list
-
- def get_arches(self):
- for x in self.find_arch_modules():
- self._arch_modules[x] = catalyst.util.load_module("catalyst.arch." + x)
- if self._arch_modules[x] is None:
- msg("Cannot import catalyst.arch." + x + ". This usually only " + \
- "happens due to a syntax error, which should be reported as " \
- "a bug.")
- return self._arch_modules
+def find_arch_modules(self):
+ search_dir = os.path.abspath(os.path.dirname(__file__))
+ arch_module_list = [x[:-3] for x in os.listdir(search_dir) \
+ if x.endswith('.py') and not x.startswith('__')]
+ return arch_module_list
+
+def get_arches(self):
+ arch_modules = {}
+ for x in find_arch_modules():
+ arch_modules[x] = catalyst.util.load_module("catalyst.arch." + x)
+ if arch_modules[x] is None:
+ msg("Cannot import catalyst.arch." + x + ". This usually only " + \
+ "happens due to a syntax error, which should be reported as " \
+ "a bug.")
+ return arch_modules
class generic_arch:
# This is only until we move all the output stuff into catalyst.output
from catalyst.support import msg
-class targets:
+def find_target_modules():
+ 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 __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
+def get_targets():
+ target_modules = {}
+ for x in find_target_modules():
+ target_modules[x] = catalyst.util.load_module("catalyst.target." + x)
+ if 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 target_modules
def build_target_map():
target_map = {}
- targets_obj = targets()
- target_modules = targets_obj.get_targets()
- for x in target_modules:
- if hasattr(target_modules[x], '__target_map'):
- target_map.update(target_modules[x].__target_map)
+ targets = get_targets()
+ for x in targets:
+ if hasattr(targets[x], '__target_map'):
+ target_map.update(targets[x].__target_map)
return target_map
self.subarchmap = {}
machinemap = {}
- arches = catalyst.arch.arches()
- arch_modules = arches.get_arches()
- for x in arches.get_arches():
- self.subarchmap.update(arch_modules[x].__subarch_map)
- for machine in arch_modules[x].__machine_map:
- machinemap[machine] = arch_modules[x]
- for subarch in arch_modules[x].__subarch_map:
- machinemap[subarch] = arch_modules[x]
+ arches = catalyst.arch.get_arches()
+ for x in arches:
+ self.subarchmap.update(arches[x].__subarch_map)
+ for machine in arches[x].__machine_map:
+ machinemap[machine] = arches[x]
+ for subarch in arches[x].__subarch_map:
+ machinemap[subarch] = arches[x]
if "chost" in self.settings:
hostmachine = self.settings["chost"].split("-")[0]