* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2014-01-02 0:04 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2014-01-02 0:04 UTC (permalink / raw
To: gentoo-commits
commit: ef91050ab5117253e873a23e8db31ce971f830dc
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 23:55:44 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=ef91050a
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index aafcc32..8c81d97 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2014-01-22 15:52 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2014-01-22 15:52 UTC (permalink / raw
To: gentoo-commits
commit: 4ebd167d0e2f599a0886e51fdb0048d5dd74b80f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jan 12 20:48:21 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4ebd167d
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 48 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 27 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..ace43fc
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/usr/bin/python2 -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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..f6a3e51
--- a/catalyst
+++ b/catalyst/main.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python2 -OO
# Maintained in full by:
# Catalyst Team <catalyst@gentoo.org>
@@ -15,8 +14,14 @@ import getopt
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"
@@ -102,7 +107,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +123,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."
@@ -191,30 +199,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
@@ -229,11 +239,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +344,6 @@ 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
@@ -382,12 +390,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index 89b891b..f04b186 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -78,16 +78,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -105,8 +107,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2014-01-03 6:41 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2014-01-03 6:41 UTC (permalink / raw
To: gentoo-commits
commit: 7026ad58604cbcb40ec35ba1322a19786a912a43
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 06:40:03 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=7026ad58
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index 0026bd7..ab4aa7a 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -78,16 +78,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -105,8 +107,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2014-01-03 6:12 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2014-01-03 6:12 UTC (permalink / raw
To: gentoo-commits
commit: 3aa70f19ecf20eaa1f327b4ffbd00d9976da3179
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 05:41:26 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=3aa70f19
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index 0026bd7..ab4aa7a 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -78,16 +78,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -105,8 +107,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2014-01-03 5:03 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2014-01-03 5:03 UTC (permalink / raw
To: gentoo-commits
commit: 661fae4377e766e0026e1b236b3d5acc00c2eb3a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 04:39:29 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=661fae43
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index 587b903..bda0195 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2013-12-31 18:14 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-12-31 18:14 UTC (permalink / raw
To: gentoo-commits
commit: 756c7cb0859b0e26e5c157032c8b7132036bd147
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 17:59:06 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=756c7cb0
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index fcffa23..ddf7499 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2013-12-31 4:48 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:48 UTC (permalink / raw
To: gentoo-commits
commit: b45cc30a34ee90681df7e547a82d525124539730
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:40:14 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=b45cc30a
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index fcffa23..ddf7499 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2013-12-31 4:39 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:39 UTC (permalink / raw
To: gentoo-commits
commit: fafe6dd678d4e06442a40f9a7cb7f3ff182df34c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:33:36 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=fafe6dd6
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index fcffa23..ddf7499 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2013-12-31 4:22 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:22 UTC (permalink / raw
To: gentoo-commits
commit: 59db1bd5419e53014a87de16b372b5aa93583fde
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 03:58:32 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=59db1bd5
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index daba5eb..5664660 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
@ 2013-12-30 1:44 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-12-30 1:44 UTC (permalink / raw
To: gentoo-commits
commit: f44f7b1e05133b8312e809625941e92c0b4d3215
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 02:56:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Dec 29 18:54:06 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f44f7b1e
Initial rearrangement of the python directories
New minimal start script, moving the original catalyst script to catalyst/main.py.
Add __init__.py's to modules and arch sub-pkgs.
skip __init__.py when loading the modules.
Update the module loading paths for the new locations.
Fix catalyst_support import to new location and specify imported modules.
---
bin/catalyst | 46 +++++++++++++++++++++
{modules => catalyst}/__init__.py | 0
catalyst/arch/__init__.py | 1 +
{arch => catalyst/arch}/alpha.py | 0
{arch => catalyst/arch}/amd64.py | 0
{arch => catalyst/arch}/arm.py | 0
{arch => catalyst/arch}/hppa.py | 0
{arch => catalyst/arch}/ia64.py | 0
{arch => catalyst/arch}/mips.py | 0
{arch => catalyst/arch}/powerpc.py | 0
{arch => catalyst/arch}/s390.py | 0
{arch => catalyst/arch}/sh.py | 0
{arch => catalyst/arch}/sparc.py | 0
{arch => catalyst/arch}/x86.py | 0
{modules/catalyst => catalyst}/config.py | 0
catalyst => catalyst/main.py | 47 +++++++++++++---------
catalyst/modules/__init__.py | 1 +
{modules => catalyst/modules}/builder.py | 0
{modules => catalyst/modules}/catalyst_lock.py | 0
{modules => catalyst/modules}/catalyst_support.py | 0
{modules => catalyst/modules}/embedded_target.py | 0
.../modules}/generic_stage_target.py | 15 +++----
{modules => catalyst/modules}/generic_target.py | 0
{modules => catalyst/modules}/grp_target.py | 0
.../modules}/livecd_stage1_target.py | 0
.../modules}/livecd_stage2_target.py | 0
{modules => catalyst/modules}/netboot2_target.py | 0
{modules => catalyst/modules}/netboot_target.py | 0
{modules => catalyst/modules}/snapshot_target.py | 0
{modules => catalyst/modules}/stage1_target.py | 0
{modules => catalyst/modules}/stage2_target.py | 0
{modules => catalyst/modules}/stage3_target.py | 0
{modules => catalyst/modules}/stage4_target.py | 0
{modules => catalyst/modules}/tinderbox_target.py | 0
{modules/catalyst => catalyst}/util.py | 0
modules/catalyst/__init__.py | 0
36 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/bin/catalyst b/bin/catalyst
new file mode 100755
index 0000000..a4e55db
--- /dev/null
+++ b/bin/catalyst
@@ -0,0 +1,46 @@
+#!/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)
+
diff --git a/modules/__init__.py b/catalyst/__init__.py
similarity index 100%
rename from modules/__init__.py
rename to catalyst/__init__.py
diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/arch/__init__.py
@@ -0,0 +1 @@
+
diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
similarity index 100%
rename from arch/alpha.py
rename to catalyst/arch/alpha.py
diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
similarity index 100%
rename from arch/amd64.py
rename to catalyst/arch/amd64.py
diff --git a/arch/arm.py b/catalyst/arch/arm.py
similarity index 100%
rename from arch/arm.py
rename to catalyst/arch/arm.py
diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
similarity index 100%
rename from arch/hppa.py
rename to catalyst/arch/hppa.py
diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
similarity index 100%
rename from arch/ia64.py
rename to catalyst/arch/ia64.py
diff --git a/arch/mips.py b/catalyst/arch/mips.py
similarity index 100%
rename from arch/mips.py
rename to catalyst/arch/mips.py
diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
similarity index 100%
rename from arch/powerpc.py
rename to catalyst/arch/powerpc.py
diff --git a/arch/s390.py b/catalyst/arch/s390.py
similarity index 100%
rename from arch/s390.py
rename to catalyst/arch/s390.py
diff --git a/arch/sh.py b/catalyst/arch/sh.py
similarity index 100%
rename from arch/sh.py
rename to catalyst/arch/sh.py
diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
similarity index 100%
rename from arch/sparc.py
rename to catalyst/arch/sparc.py
diff --git a/arch/x86.py b/catalyst/arch/x86.py
similarity index 100%
rename from arch/x86.py
rename to catalyst/arch/x86.py
diff --git a/modules/catalyst/config.py b/catalyst/config.py
similarity index 100%
rename from modules/catalyst/config.py
rename to catalyst/config.py
diff --git a/catalyst b/catalyst/main.py
old mode 100755
new mode 100644
similarity index 91%
rename from catalyst
rename to catalyst/main.py
index cb6c022..aebb495
--- a/catalyst
+++ b/catalyst/main.py
@@ -15,8 +15,14 @@ import getopt
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"
@@ -102,7 +108,7 @@ def parse_config(myconfig):
# 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:
@@ -118,6 +124,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."
@@ -191,30 +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
@@ -229,11 +240,11 @@ def build_target(addlargs, targetmap):
mytarget.run()
except:
- modules.catalyst.util.print_traceback()
+ catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
sys.exit(1)
-if __name__ == "__main__":
+def main():
targetmap={}
version()
@@ -334,8 +345,6 @@ 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
@@ -382,12 +391,12 @@ if __name__ == "__main__":
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:
diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/modules/__init__.py
@@ -0,0 +1 @@
+
diff --git a/modules/builder.py b/catalyst/modules/builder.py
similarity index 100%
rename from modules/builder.py
rename to catalyst/modules/builder.py
diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
similarity index 100%
rename from modules/catalyst_lock.py
rename to catalyst/modules/catalyst_lock.py
diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
similarity index 100%
rename from modules/catalyst_support.py
rename to catalyst/modules/catalyst_support.py
diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
similarity index 100%
rename from modules/embedded_target.py
rename to catalyst/modules/embedded_target.py
diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
similarity index 99%
rename from modules/generic_stage_target.py
rename to catalyst/modules/generic_stage_target.py
index f69f192..3e33358 100644
--- a/modules/generic_stage_target.py
+++ b/catalyst/modules/generic_stage_target.py
@@ -67,16 +67,18 @@ 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")]:
+ if x == "__init__":
+ continue
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
@@ -94,8 +96,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]
diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
similarity index 100%
rename from modules/generic_target.py
rename to catalyst/modules/generic_target.py
diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
similarity index 100%
rename from modules/grp_target.py
rename to catalyst/modules/grp_target.py
diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
similarity index 100%
rename from modules/livecd_stage1_target.py
rename to catalyst/modules/livecd_stage1_target.py
diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
similarity index 100%
rename from modules/livecd_stage2_target.py
rename to catalyst/modules/livecd_stage2_target.py
diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
similarity index 100%
rename from modules/netboot2_target.py
rename to catalyst/modules/netboot2_target.py
diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
similarity index 100%
rename from modules/netboot_target.py
rename to catalyst/modules/netboot_target.py
diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
similarity index 100%
rename from modules/snapshot_target.py
rename to catalyst/modules/snapshot_target.py
diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
similarity index 100%
rename from modules/stage1_target.py
rename to catalyst/modules/stage1_target.py
diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
similarity index 100%
rename from modules/stage2_target.py
rename to catalyst/modules/stage2_target.py
diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
similarity index 100%
rename from modules/stage3_target.py
rename to catalyst/modules/stage3_target.py
diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
similarity index 100%
rename from modules/stage4_target.py
rename to catalyst/modules/stage4_target.py
diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
similarity index 100%
rename from modules/tinderbox_target.py
rename to catalyst/modules/tinderbox_target.py
diff --git a/modules/catalyst/util.py b/catalyst/util.py
similarity index 100%
rename from modules/catalyst/util.py
rename to catalyst/util.py
diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-01-22 17:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-02 0:04 [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2014-01-22 15:52 Brian Dolbec
2014-01-03 6:41 Brian Dolbec
2014-01-03 6:12 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2013-12-31 18:14 Brian Dolbec
2013-12-31 4:48 Brian Dolbec
2013-12-31 4:39 Brian Dolbec
2013-12-31 4:22 Brian Dolbec
2013-12-30 1:44 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox