From: Andrew Gaffney Date: Sun, 11 Jan 2009 01:54:36 +0000 (-0600) Subject: Move target module loading logic into build_target_map() in catalyst.target module X-Git-Tag: CATALYST-2.0.10~3^2~233 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=31b4c312417a84798c56b1809de60aa2e4e644ee;p=catalyst.git Move target module loading logic into build_target_map() in catalyst.target module --- diff --git a/ChangeLog b/ChangeLog index 758c6a1b..d8e2325e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS) # Distributed under the GPL v2 + 11 Jan 2009; Andrew Gaffney catalyst, + modules/catalyst/target/__init__.py, + modules/catalyst/target/generic_stage_target.py: + Move target module loading logic into build_target_map() in + catalyst.target module + 11 Jan 2009; Andrew Gaffney catalyst, modules/catalyst/target/embedded_target.py, modules/catalyst/target/grp_target.py, diff --git a/catalyst b/catalyst index 4de6fe48..e050987e 100755 --- a/catalyst +++ b/catalyst @@ -167,12 +167,9 @@ def parse_config(myconfig): def import_modules(): # import catalyst's own modules (i.e. catalyst_support and the arch modules) - targetmap={} - - targets = catalyst.target.targets() - for x in targets.get_targets(): - targetmap.update(x.__target_map) + import catalyst.target + targetmap = catalyst.target.build_target_map() return targetmap def build_target(addlargs, targetmap): @@ -287,7 +284,7 @@ if __name__ == "__main__": # import configuration file and import our main module using those settings parse_config(myconfig) - sys.path.append(conf_values["sharedir"]+"/modules") + from catalyst_support import * # Start checking that digests are valid now that the hash_map was imported from catalyst_support diff --git a/modules/catalyst/target/__init__.py b/modules/catalyst/target/__init__.py index 99e1a7fb..8a90e2dd 100644 --- a/modules/catalyst/target/__init__.py +++ b/modules/catalyst/target/__init__.py @@ -28,3 +28,12 @@ class targets: "happens due to a syntax error, which should be reported as " \ "a bug.") return self._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) + return target_map diff --git a/modules/catalyst/target/generic_stage_target.py b/modules/catalyst/target/generic_stage_target.py index 8cbed1ba..76ce57d9 100644 --- a/modules/catalyst/target/generic_stage_target.py +++ b/modules/catalyst/target/generic_stage_target.py @@ -49,17 +49,17 @@ class generic_stage_target(generic_target): previously. -agaffney """ - self.archmap = {} self.subarchmap = {} machinemap = {} + arches = catalyst.arch.arches() + arch_modules = arches.get_arches() for x in arches.get_arches(): - tmpsubarchmap, tmpmachinemap = self.archmap[x].register() - self.subarchmap.update(x.__subarch_map) - for machine in x.__machine_map: - machinemap[machine] = x - for subarch in x.__subarch_map: - machinemap[subarch] = x + 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] if self.settings.has_key("chost"): hostmachine = self.settings["chost"].split("-")[0]