From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
Date: Tue, 31 Dec 2013 04:22:11 +0000 (UTC) [thread overview]
Message-ID: <1388462312.59db1bd5419e53014a87de16b372b5aa93583fde.dol-sen@gentoo> (raw)
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
next reply other threads:[~2013-12-31 4:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-31 4:22 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-01-22 15:52 [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, Brian Dolbec
2014-01-03 6:41 Brian Dolbec
2014-01-03 6:12 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2014-01-02 0:04 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-30 1:44 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388462312.59db1bd5419e53014a87de16b372b5aa93583fde.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox