From: Brian Dolbec Date: Fri, 11 Jan 2013 03:34:53 +0000 (-0800) Subject: update the module loading paths for the new locations X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aa2a8795839fe0c0964e6729e9a03934216aee02;p=catalyst.git update the module loading paths for the new locations --- diff --git a/catalyst/main.py b/catalyst/main.py index 763107b0..b4390b2e 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -119,6 +119,9 @@ def parse_config(myconfig): print "Setting",x,"to default value \""+confdefaults[x]+"\"" conf_values[x]=confdefaults[x] + # add our python base directory to use for loading target arch's + conf_values["PythonDir"] = __selfpath__ + # parse out the rest of the options from the config file if "autoresume" in string.split(conf_values["options"]): print "Autoresuming support enabled." @@ -197,32 +200,32 @@ def import_modules(): targetmap={} try: + module_dir = __selfpath__ + "/modules/" for x in required_build_targets: try: - fh=open(conf_values["sharedir"]+"/modules/"+x+".py") - module=imp.load_module(x,fh,"modules/"+x+".py", - (".py","r",imp.PY_SOURCE)) + fh=open(module_dir + x + ".py") + module=imp.load_module(x, fh,"modules/" + x + ".py", + (".py", "r", imp.PY_SOURCE)) fh.close() except IOError: - raise CatalystError,"Can't find "+x+".py plugin in "+\ - conf_values["sharedir"]+"/modules/" - + raise CatalystError, "Can't find " + x + ".py plugin in " + \ + module_dir for x in valid_build_targets: try: - fh=open(conf_values["sharedir"]+"/modules/"+x+".py") - module=imp.load_module(x,fh,"modules/"+x+".py", - (".py","r",imp.PY_SOURCE)) + fh=open(module_dir + x + ".py") + module=imp.load_module(x, fh, "modules/" + x + ".py", + (".py", "r", imp.PY_SOURCE)) module.register(targetmap) fh.close() except IOError: - raise CatalystError,"Can't find "+x+".py plugin in "+\ - conf_values["sharedir"]+"/modules/" + raise CatalystError,"Can't find " + x + ".py plugin in " + \ + module_dir except ImportError: print "!!! catalyst: Python modules not found in "+\ - conf_values["sharedir"]+"/modules; exiting." + module_dir + "; exiting." sys.exit(1) return targetmap diff --git a/catalyst/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py index 927b4c33..f77527d4 100644 --- a/catalyst/modules/generic_stage_target.py +++ b/catalyst/modules/generic_stage_target.py @@ -48,16 +48,16 @@ class generic_stage_target(generic_target): self.archmap = {} self.subarchmap = {} machinemap = {} - for x in [x[:-3] for x in os.listdir(self.settings["sharedir"]+\ - "/arch/") if x.endswith(".py")]: + arch_dir = self.settings["PythonDir"] + "/arch/" + for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py")]: try: - fh=open(self.settings["sharedir"]+"/arch/"+x+".py") + fh=open(arch_dir + x + ".py") """ This next line loads the plugin as a module and assigns it to archmap[x] """ - self.archmap[x]=imp.load_module(x,fh,"arch/"+x+\ - ".py",(".py","r",imp.PY_SOURCE)) + self.archmap[x]=imp.load_module(x,fh,"../arch/" + x + ".py", + (".py", "r", imp.PY_SOURCE)) """ This next line registers all the subarches supported in the plugin @@ -75,8 +75,7 @@ class generic_stage_target(generic_target): the dir should load just fine. If it doesn't, it's probably a syntax error in the module """ - msg("Can't find/load "+x+".py plugin in "+\ - self.settings["sharedir"]+"/arch/") + msg("Can't find/load " + x + ".py plugin in " + arch_dir) if "chost" in self.settings: hostmachine = self.settings["chost"].split("-")[0]