# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org> -arch/alpha.py,
+ -arch/amd64.py, -arch/arm.py, -arch/hppa.py, -arch/ia64.py, -arch/mips.py,
+ -arch/powerpc.py, -arch/s390.py, -arch/sh.py, -arch/sparc.py,
+ -arch/x86.py, +modules/catalyst/arch/__init__.py,
+ +modules/catalyst/arch/alpha.py, +modules/catalyst/arch/amd64.py,
+ +modules/catalyst/arch/arm.py, +modules/catalyst/arch/hppa.py,
+ +modules/catalyst/arch/ia64.py, +modules/catalyst/arch/mips.py,
+ +modules/catalyst/arch/powerpc.py, +modules/catalyst/arch/s390.py,
+ +modules/catalyst/arch/sh.py, +modules/catalyst/arch/sparc.py,
+ +modules/catalyst/arch/x86.py, modules/catalyst/util.py, +.gitignore:
+ --help
+
10 Jan 2009; Andrew Gaffney <agaffney@gentoo.org> catalyst:
Change __version__ to 2.99 for catalyst_3 branch
--- /dev/null
+"""
+Parent module of all arch modules
+"""
+
+import os
+import imp
+import catalyst.util
+
+# This hard-coded list of arch is here until I find a good way to get a list of
+# other modules contained in the same dir as this file
+__arch_module_list = (
+ "alpha",
+ "amd64",
+ "arm",
+ "hppa",
+ "ia64",
+ "mips",
+ "powerpc",
+ "s390",
+ "sh",
+ "sparc",
+ "x86"
+)
+
+class arches:
+
+ __arch_modules = None
+
+ 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')]
+ return arch_module_list
+
+ def get_arches(self):
+ self.archmap = {}
+ self.subarchmap = {}
+ machinemap = {}
+ # We don't know if this works yet
+# for x in self.find_arch_modules():
+ for x in __arch_module_list:
+ 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.")
+