--- /dev/null
+#!/usr/bin/python -OO
+
+# Maintained in full by:
+# Catalyst Team <catalyst@gentoo.org>
+# Release Engineering Team <releng@gentoo.org>
+# Andrew Gaffney <agaffney@gentoo.org>
+# Chris Gianelloni <wolf31o2@wolf31o2.org>
+# $Id$
+
+
+from __future__ import print_function
+
+import sys
+
+__maintainer__="Catalyst <catalyst@gentoo.org>"
+__version__="2.0.12.2"
+
+
+# This block ensures that ^C interrupts are handled quietly.
+try:
+ import signal
+
+ def exithandler(signum,frame):
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+ signal.signal(signal.SIGTERM, signal.SIG_IGN)
+ print()
+ sys.exit(1)
+
+ signal.signal(signal.SIGINT, exithandler)
+ signal.signal(signal.SIGTERM, exithandler)
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+except KeyboardInterrupt:
+ print()
+ sys.exit(1)
+
+
+from catalyst.main import main
+
+try:
+ main()
+except KeyboardInterrupt:
+ print("Aborted.")
+ sys.exit(130)
+sys.exit(0)
+
import pdb
import os.path
-import modules.catalyst.config
-import modules.catalyst.util
+__selfpath__ = os.path.abspath(os.path.dirname(__file__))
+
+sys.path.append(__selfpath__ + "/modules")
+
+import catalyst.config
+import catalyst.util
+from catalyst.modules.catalyst_support import (required_build_targets,
+ valid_build_targets, CatalystError, hash_map, find_binary, LockInUse)
__maintainer__="Catalyst <catalyst@gentoo.org>"
__version__="2.0.15"
# now, try and parse the config file "config_file"
try:
# execfile(config_file, myconf, myconf)
- myconfig = modules.catalyst.config.ConfigParser(config_file)
+ myconfig = catalyst.config.ConfigParser(config_file)
myconf.update(myconfig.get_values())
except:
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."
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
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
# 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
addlargs={}
if myspecfile:
- spec = modules.catalyst.config.SpecParser(myspecfile)
+ spec = catalyst.config.SpecParser(myspecfile)
addlargs.update(spec.get_values())
if mycmdline:
try:
- cmdline = modules.catalyst.config.ConfigParser()
+ cmdline = catalyst.config.ConfigParser()
cmdline.parse_lines(mycmdline)
addlargs.update(cmdline.get_values())
except CatalystError:
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
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]