From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 80558138247 for ; Tue, 31 Dec 2013 04:39:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2B7A0E0AA9; Tue, 31 Dec 2013 04:39:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 35153E0B03 for ; Tue, 31 Dec 2013 04:39:30 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 05EA833F6E0 for ; Tue, 31 Dec 2013 04:39:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id CD85CE553A for ; Tue, 31 Dec 2013 04:39:26 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1388464416.fafe6dd678d4e06442a40f9a7cb7f3ff182df34c.dol-sen@gentoo> Subject: [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ... X-VCS-Repository: proj/catalyst X-VCS-Files: arch/alpha.py arch/amd64.py arch/arm.py arch/hppa.py arch/ia64.py arch/mips.py arch/powerpc.py arch/s390.py arch/sh.py arch/sparc.py arch/x86.py bin/catalyst catalyst catalyst/__init__.py catalyst/arch/__init__.py catalyst/arch/alpha.py catalyst/arch/amd64.py catalyst/arch/arm.py catalyst/arch/hppa.py catalyst/arch/ia64.py catalyst/arch/mips.py catalyst/arch/powerpc.py catalyst/arch/s390.py catalyst/arch/sh.py catalyst/arch/sparc.py catalyst/arch/x86.py catalyst/config.py catalyst/main.py catalyst/modules/__init__.py catalyst/modules/builder.py catalyst/modules/catalyst_lock.py catalyst/modules/catalyst_support.py catalyst/modules/embedded_target.py catalyst/modules/generic_stage_target.py catalyst/modules/generic_target.py catalyst/modules/grp_target.py catalyst/modules/livecd_stage1_target.py catalyst/modules/livecd_stage2_target.py catalyst/modules/netboot2_target.py catalyst/modules/netboot_target.py catalyst/modules/snapshot_target.py catalyst/modules/stage1_target. py catalyst/modules/stage2_target.py catalyst/modules/stage3_target.py catalyst/modules/stage4_target.py catalyst/modules/tinderbox_target.py catalyst/util.py modules/__init__.py modules/builder.py modules/catalyst/__init__.py modules/catalyst/config.py modules/catalyst/util.py modules/catalyst_lock.py modules/catalyst_support.py modules/embedded_target.py modules/generic_stage_target.py modules/generic_target.py modules/grp_target.py modules/livecd_stage1_target.py modules/livecd_stage2_target.py modules/netboot2_target.py modules/netboot_target.py modules/snapshot_target.py modules/stage1_target.py modules/stage2_target.py modules/stage3_target.py modules/stage4_target.py modules/tinderbox_target.py X-VCS-Directories: modules/catalyst/ / catalyst/arch/ catalyst/ catalyst/modules/ bin/ arch/ modules/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: fafe6dd678d4e06442a40f9a7cb7f3ff182df34c X-VCS-Branch: pending Date: Tue, 31 Dec 2013 04:39:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5490d20c-162e-4b1f-8887-afcdd5c47f81 X-Archives-Hash: 7a29c40fe0e94592ed077c4a4a94531d commit: fafe6dd678d4e06442a40f9a7cb7f3ff182df34c Author: Brian Dolbec gentoo org> AuthorDate: Fri Jan 11 02:56:28 2013 +0000 Commit: Brian Dolbec gmail 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 +# Release Engineering Team +# Andrew Gaffney +# Chris Gianelloni +# $Id$ + + +from __future__ import print_function + +import sys + +__maintainer__="Catalyst " +__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 " __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