commit:     7d8c62bdf311d774b7d60429c3a72a1fecb7166f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 20 04:29:16 2013 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 05:58:06 2015 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=7d8c62bd

Pyflakes import cleanup and broken CatalystError calls.

Replace "import *" with named imports, remove unused imports.
Fix broken CatalystError usage.

Conflicts:
        catalyst/base/stagebase.py
        catalyst/defaults.py
        catalyst/main.py
        catalyst/support.py
        catalyst/targets/embedded.py
        catalyst/targets/generic_target.py
        catalyst/targets/grp.py
        catalyst/targets/livecd_stage1.py
        catalyst/targets/livecd_stage2.py
        catalyst/targets/netboot.py
        catalyst/targets/netboot2.py
        catalyst/targets/snapshot.py
        catalyst/targets/stage1.py
        catalyst/targets/stage2.py
        catalyst/targets/stage3.py
        catalyst/targets/stage4.py
        catalyst/targets/tinderbox.py

---
 catalyst/arch/alpha.py            |  3 +-
 catalyst/arch/arm.py              |  2 --
 catalyst/arch/hppa.py             |  3 --
 catalyst/arch/ia64.py             |  3 --
 catalyst/arch/mips.py             |  3 --
 catalyst/arch/powerpc.py          |  5 ++--
 catalyst/arch/s390.py             |  3 --
 catalyst/arch/sh.py               |  3 --
 catalyst/arch/sparc.py            |  5 ++--
 catalyst/arch/x86.py              |  5 ++--
 catalyst/base/stagebase.py        | 58 +++++++++++++++++++++------------------
 catalyst/config.py                |  9 +++---
 catalyst/contents.py              |  8 +++---
 catalyst/hash_utils.py            |  4 +--
 catalyst/lock.py                  |  5 ++--
 catalyst/main.py                  | 13 ++-------
 catalyst/support.py               | 49 +++++++++++++++++----------------
 catalyst/targets/grp.py           |  5 ++--
 catalyst/targets/livecd_stage1.py |  4 +--
 catalyst/targets/livecd_stage2.py | 14 ++++++++--
 catalyst/targets/netboot.py       | 15 ++++++----
 catalyst/targets/netboot2.py      |  8 ++++--
 catalyst/targets/tinderbox.py     |  3 +-
 targets/stage1/build.py           |  4 ++-
 24 files changed, 118 insertions(+), 116 deletions(-)

diff --git a/catalyst/arch/alpha.py b/catalyst/arch/alpha.py
index 7248020..01b6382 100644
--- a/catalyst/arch/alpha.py
+++ b/catalyst/arch/alpha.py
@@ -1,8 +1,7 @@
 
-import os
 
 from catalyst import builder
-from catalyst.support import *
+
 
 class generic_alpha(builder.generic):
        "abstract base class for all alpha builders"

diff --git a/catalyst/arch/arm.py b/catalyst/arch/arm.py
index 8f207ff..c0d322c 100644
--- a/catalyst/arch/arm.py
+++ b/catalyst/arch/arm.py
@@ -1,8 +1,6 @@
 
-import os
 
 from catalyst import builder
-from catalyst.support import *
 
 class generic_arm(builder.generic):
        "Abstract base class for all arm (little endian) builders"

diff --git a/catalyst/arch/hppa.py b/catalyst/arch/hppa.py
index 3aac9b6..c5589c4 100644
--- a/catalyst/arch/hppa.py
+++ b/catalyst/arch/hppa.py
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_hppa(builder.generic):
        "Abstract base class for all hppa builders"

diff --git a/catalyst/arch/ia64.py b/catalyst/arch/ia64.py
index 4003085..3f06040 100644
--- a/catalyst/arch/ia64.py
+++ b/catalyst/arch/ia64.py
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class arch_ia64(builder.generic):
        "builder class for ia64"

diff --git a/catalyst/arch/mips.py b/catalyst/arch/mips.py
index 7cce392..5297a4b 100644
--- a/catalyst/arch/mips.py
+++ b/catalyst/arch/mips.py
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_mips(builder.generic):
        "Abstract base class for all mips builders [Big-endian]"

diff --git a/catalyst/arch/powerpc.py b/catalyst/arch/powerpc.py
index 6cec580..f903b38 100644
--- a/catalyst/arch/powerpc.py
+++ b/catalyst/arch/powerpc.py
@@ -2,7 +2,7 @@
 import os
 
 from catalyst import builder
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class generic_ppc(builder.generic):
        "abstract base class for all 32-bit powerpc builders"
@@ -11,7 +11,8 @@ class generic_ppc(builder.generic):
                self.settings["CHOST"]="powerpc-unknown-linux-gnu"
                if self.settings["buildarch"]=="ppc64":
                        if not os.path.exists("/bin/linux32") and not 
os.path.exists("/usr/bin/linux32"):
-                               raise CatalystError,"required executable 
linux32 not found (\"emerge setarch\" to fix.)"
+                               raise CatalystError("required executable 
linux32 not found "
+                                       "(\"emerge setarch\" to fix.)", 
print_traceback=True)
                        self.settings["CHROOT"]="linux32 chroot"
                        self.settings["crosscompile"] = False;
                else:

diff --git a/catalyst/arch/s390.py b/catalyst/arch/s390.py
index c49e0b7..f2cf80d 100644
--- a/catalyst/arch/s390.py
+++ b/catalyst/arch/s390.py
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_s390(builder.generic):
        "abstract base class for all s390 builders"

diff --git a/catalyst/arch/sh.py b/catalyst/arch/sh.py
index 1fa1b0b..64d6e0e 100644
--- a/catalyst/arch/sh.py
+++ b/catalyst/arch/sh.py
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_sh(builder.generic):
        "Abstract base class for all sh builders [Little-endian]"

diff --git a/catalyst/arch/sparc.py b/catalyst/arch/sparc.py
index 2889528..da2ad35 100644
--- a/catalyst/arch/sparc.py
+++ b/catalyst/arch/sparc.py
@@ -2,7 +2,7 @@
 import os
 
 from catalyst import builder
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class generic_sparc(builder.generic):
        "abstract base class for all sparc builders"
@@ -10,7 +10,8 @@ class generic_sparc(builder.generic):
                builder.generic.__init__(self,myspec)
                if self.settings["buildarch"]=="sparc64":
                        if not os.path.exists("/bin/linux32") and not 
os.path.exists("/usr/bin/linux32"):
-                               raise CatalystError,"required executable 
linux32 not found (\"emerge setarch\" to fix.)"
+                               raise CatalystError("required executable 
linux32 not found "
+                                       "(\"emerge setarch\" to fix.)", 
print_traceback=True)
                        self.settings["CHROOT"]="linux32 chroot"
                        self.settings["crosscompile"] = False;
                else:

diff --git a/catalyst/arch/x86.py b/catalyst/arch/x86.py
index c8d1911..9f1bba2 100644
--- a/catalyst/arch/x86.py
+++ b/catalyst/arch/x86.py
@@ -2,7 +2,7 @@
 import os
 
 from catalyst import builder
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class generic_x86(builder.generic):
        "abstract base class for all x86 builders"
@@ -10,7 +10,8 @@ class generic_x86(builder.generic):
                builder.generic.__init__(self,myspec)
                if self.settings["buildarch"]=="amd64":
                        if not os.path.exists("/bin/linux32") and not 
os.path.exists("/usr/bin/linux32"):
-                                       raise CatalystError,"required 
executable linux32 not found (\"emerge setarch\" to fix.)"
+                                       raise CatalystError("required 
executable linux32 not found "
+                                               "(\"emerge setarch\" to fix.)", 
print_traceback=True)
                        self.settings["CHROOT"]="linux32 chroot"
                        self.settings["crosscompile"] = False;
                else:

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index daf8e54..c16ef86 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -98,7 +98,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                if "chost" in self.settings:
                        hostmachine = self.settings["chost"].split("-")[0]
                        if hostmachine not in machinemap:
-                               raise CatalystError, "Unknown host machine type 
"+hostmachine
+                               raise CatalystError("Unknown host machine type 
"+hostmachine)
                        self.settings["hostarch"]=machinemap[hostmachine]
                else:
                        hostmachine = self.settings["subarch"]
@@ -110,7 +110,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                else:
                        buildmachine = os.uname()[4]
                if buildmachine not in machinemap:
-                       raise CatalystError, "Unknown build machine type 
"+buildmachine
+                       raise CatalystError("Unknown build machine type 
"+buildmachine)
                self.settings["buildarch"]=machinemap[buildmachine]
                self.settings["crosscompile"]=(self.settings["hostarch"]!=\
                        self.settings["buildarch"])
@@ -237,9 +237,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        else:
                                ccdir="/root/.ccache"
                        if not os.path.isdir(ccdir):
-                               raise CatalystError,\
+                               raise CatalystError(
                                        "Compiler cache support can't be 
enabled (can't find "+\
-                                       ccdir+")"
+                                       ccdir+")")
                        self.mounts.append("ccache")
                        self.mountmap["ccache"] = ccdir
                        """ for the chroot: """
@@ -296,8 +296,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
        def set_source_subpath(self):
                if type(self.settings["source_subpath"])!=types.StringType:
-                       raise CatalystError,\
-                               "source_subpath should have been a string. 
Perhaps you have something wrong in your spec file?"
+                       raise CatalystError(
+                               "source_subpath should have been a string. 
Perhaps you have " +\
+                               "something wrong in your spec file?")
 
        def set_pkgcache_path(self):
                if "pkgcache_path" in self.settings:
@@ -498,8 +499,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        self.settings["iso_volume_id"]=\
                                
self.settings[self.settings["spec_prefix"]+"/volid"]
                        if len(self.settings["iso_volume_id"])>32:
-                               raise CatalystError,\
-                                       "ISO volume ID must not exceed 32 
characters."
+                               raise CatalystError(
+                                       "ISO volume ID must not exceed 32 
characters.")
                else:
                        self.settings["iso_volume_id"]="catalyst 
"+self.settings["snapshot"]
 
@@ -658,11 +659,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                        """ Try to umount stuff ourselves """
                                        self.unbind()
                                        if ismount(target):
-                                               raise CatalystError, 
"Auto-unbind failed for " + target
+                                               raise 
CatalystError("Auto-unbind failed for " + target)
                                        else:
                                                print "Auto-unbind 
successful..."
                                except CatalystError:
-                                       raise CatalystError, "Unable to 
auto-unbind " + target
+                                       raise CatalystError("Unable to 
auto-unbind " + target)
 
        def unpack(self):
                unpack=True
@@ -755,8 +756,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                        invalid_snapshot=True
                                elif 
os.path.isdir(self.settings["source_path"]):
                                        """ We should never reach this, so 
something is very wrong """
-                                       raise CatalystError,\
-                                               "source path is a dir but 
seedcache is not enabled"
+                                       raise CatalystError(
+                                               "source path is a dir but 
seedcache is not enabled")
 
                if unpack:
                        self.mount_safety_check()
@@ -968,7 +969,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                        retval=os.system(cmd)
                        if retval!=0:
                                self.unbind()
-                               raise CatalystError,"Couldn't bind mount " + src
+                               raise CatalystError("Couldn't bind mount " + 
src)
 
        def unbind(self):
                ouch=0
@@ -1013,8 +1014,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        this to potentially prevent an upcoming bash stage 
cleanup script
                        from wiping our bind mounts.
                        """
-                       raise CatalystError,\
-                               "Couldn't umount one or more bind-mounts; 
aborting for safety."
+                       raise CatalystError(
+                               "Couldn't umount one or more bind-mounts; 
aborting for safety.")
 
        def chroot_setup(self):
                
self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+
@@ -1038,8 +1039,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        """ Copy over the envscript, if applicable """
                        if "envscript" in self.settings:
                                if not 
os.path.exists(self.settings["envscript"]):
-                                       raise CatalystError,\
-                                               "Can't find envscript 
"+self.settings["envscript"]
+                                       raise CatalystError(
+                                               "Can't find envscript " + 
self.settings["envscript"],
+                                               print_traceback=True)
 
                                print "\nWarning!!!!"
                                print "\tOverriding certain env variables may 
cause catastrophic failure."
@@ -1250,7 +1252,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
                        except:
                                self.unbind()
-                               raise CatalystError, "Build failed, could not 
execute preclean"
+                               raise CatalystError("Build failed, could not 
execute preclean")
 
        def capture(self):
                capture_resume = pjoin(self.settings["autoresume_path"], 
"capture")
@@ -1293,7 +1295,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"Stage build aborting due 
to error."
+                               raise CatalystError("Stage build aborting due 
to error.",
+                                       print_traceback=True)
 
        def setup_environment(self):
                """
@@ -1466,8 +1469,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                                touch(build_packages_resume)
                                        except CatalystError:
                                                self.unbind()
-                                               raise 
CatalystError,self.settings["spec_prefix"]+\
-                                                       "build aborting due to 
error."
+                                               raise 
CatalystError(self.settings["spec_prefix"]+\
+                                                       "build aborting due to 
error.")
 
        def build_kernel(self):
                '''Build all configured kernels'''
@@ -1493,8 +1496,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                        touch(build_kernel_resume)
                                except CatalystError:
                                        self.unbind()
-                                       raise CatalystError,\
-                                               "build aborting due to kernel 
build error."
+                                       raise CatalystError(
+                                               "build aborting due to kernel 
build error.",
+                                               print_traceback=True)
 
        def _build_kernel(self, kname):
                "Build a single configured kernel by name"
@@ -1557,10 +1561,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
                if "boot/kernel/"+kname+"/config" in self.settings:
                        if not 
os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
                                self.unbind()
-                               raise CatalystError,\
+                               raise CatalystError(
                                        "Can't find kernel config: "+\
                                        self.settings["boot/kernel/"+kname+\
-                                       "/config"]
+                                       "/config"])
 
                        try:
                                cmd("cp "+self.settings["boot/kernel/"+kname+\
@@ -1608,7 +1612,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                touch(bootloader_resume)
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"Script aborting due to 
error."
+                               raise CatalystError("Script aborting due to 
error.")
 
        def livecd_update(self):
                livecd_update_resume = pjoin(self.settings["autoresume_path"],
@@ -1624,6 +1628,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"build aborting due to 
livecd_update error."
+                               raise CatalystError("build aborting due to 
livecd_update error.")
 
 # vim: ts=4 sw=4 sta et sts=4 ai

diff --git a/catalyst/config.py b/catalyst/config.py
index bf3c7c6..c952648 100644
--- a/catalyst/config.py
+++ b/catalyst/config.py
@@ -1,6 +1,6 @@
 
 import re
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class ParserBase:
 
@@ -27,7 +27,8 @@ class ParserBase:
                try:
                        myf = open(filename, "r")
                except:
-                       raise CatalystError, "Could not open file " + filename
+                       raise CatalystError("Could not open file " + filename,
+                               print_traceback=True)
                self.lines = myf.readlines()
                myf.close()
                self.filename = filename
@@ -42,7 +43,7 @@ class ParserBase:
                cur_array = []
 
                trailing_comment=re.compile('\s*#.*$')
-               white_space=re.compile('\s+')
+               #white_space=re.compile('\s+')
 
                for x, myline in enumerate(self.lines):
                        myline = myline.strip()
@@ -84,7 +85,7 @@ class ParserBase:
 #                                      cur_array += mobjs
                                        cur_array += myline.split()
                                else:
-                                       raise CatalystError, "Syntax error: " + 
x
+                                       raise CatalystError("Syntax error: " + 
x, print_traceback=True)
 
                        # XXX: Do we really still need this "single value is a 
string" behavior?
                        if len(cur_array) == 2:

diff --git a/catalyst/contents.py b/catalyst/contents.py
index 79ef9a6..9611890 100644
--- a/catalyst/contents.py
+++ b/catalyst/contents.py
@@ -69,10 +69,10 @@ class ContentsMap(object):
                                func = getattr(self, '_%s_' % 
self.contents_map[getter].func)
                                return func(file_, 
self.contents_map[getter].cmd, verbose)
                except:
-                       raise CatalystError,\
-                               "Error generating contents, is appropriate 
utility " +\
-                               "(%s) installed on your system?" \
-                               % (self.contents_map[getter].cmd)
+                       raise CatalystError(
+                               "Error generating contents, is appropriate 
utility " +
+                               "(%s) installed on your system?"
+                               % (self.contents_map[getter].cmd), 
print_traceback=True)
 
 
        @staticmethod

diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py
index b575ace..39f489b 100644
--- a/catalyst/hash_utils.py
+++ b/catalyst/hash_utils.py
@@ -80,8 +80,8 @@ class HashMap(object):
                                verbose
                                )
                except:
-                       raise CatalystError,"Error generating hash, is 
appropriate " + \
-                               "utility installed on your system?"
+                       raise CatalystError("Error generating hash, is 
appropriate " + \
+                               "utility installed on your system?", 
traceback=True)
 
 
        def calc_hash(self, file_, hash_, verbose=False):

diff --git a/catalyst/lock.py b/catalyst/lock.py
index c90f5b8..12d0754 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -128,7 +128,7 @@ class LockDir:
                if self.myfd==None:
                        if not os.path.exists(os.path.dirname(self.lockdir)):
                                raise CatalystError("DirectoryNotFound: %s"
-                                       % os.path.dirname(self.lockdir))
+                                       % os.path.dirname(self.lockdir), 
print_traceback=True)
                        if not os.path.exists(self.lockfile):
                                old_mask=os.umask(000)
                                self.myfd = os.open(self.lockfile, 
os.O_CREAT|os.O_RDWR,0660)
@@ -275,7 +275,8 @@ class LockDir:
                        self.add_hardlock_file_to_cleanup()
                        if not os.path.exists(self.myhardlock):
                                raise CatalystError("FileNotFound: Created 
lockfile is missing: "
-                                       "%(filename)s" % 
{"filename":self.myhardlock})
+                                       "%(filename)s" % 
{"filename":self.myhardlock},
+                                       print_traceback=True)
                        try:
                                os.link(self.myhardlock, self.lockfile)
                        except SystemExit:

diff --git a/catalyst/main.py b/catalyst/main.py
index 5fa3f1b..56e57c6 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -8,10 +8,7 @@
 
 import os
 import sys
-import imp
-import string
 import getopt
-import pdb
 import os.path
 
 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
@@ -168,7 +165,8 @@ def build_target(addlargs):
        except:
                print "Target run() exception:  Python traceback output 
follows:"
                catalyst.util.print_traceback()
-               print "!!! catalyst: Error encountered during run of target " + 
addlargs["target"]
+               print "!!! catalyst: Error encountered during run of target " + 
\
+                       addlargs["target"]
                sys.exit(1)
 
 def main():
@@ -193,14 +191,9 @@ def main():
                usage()
                sys.exit(2)
 
-       # defaults for commandline opts
-       debug=False
-       verbose=False
-       fetch=False
        myconfig=""
        myspecfile=""
        mycmdline=[]
-       myopts=[]
 
        # check preconditions
        if len(opts) == 0:
@@ -341,7 +334,7 @@ def main():
                        sys.exit(1)
 
        if "target" not in addlargs:
-               raise CatalystError, "Required value \"target\" not specified."
+               raise CatalystError("Required value \"target\" not specified.")
 
        # everything is setup, so the build is a go
        try:

diff --git a/catalyst/support.py b/catalyst/support.py
index aaacaa9..8c4876f 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -8,7 +8,6 @@ import traceback
 import time
 from subprocess import Popen
 
-
 from catalyst.defaults import verbosity, valid_config_file_values
 
 selinux_capable = False
@@ -50,7 +49,7 @@ def read_from_clst(file):
                myf=open(file,"r")
        except:
                return -1
-               #raise CatalystError, "Could not open file "+file
+               #raise CatalystError("Could not open file "+file)
        for line in myf.readlines():
                #line = string.replace(line, "\n", "") # drop newline
                myline = myline + line
@@ -85,12 +84,14 @@ def list_to_string(mylist):
 
 
 class CatalystError(Exception):
-       def __init__(self, message):
+       def __init__(self, message, print_traceback=False):
                if message:
-                       (type,value)=sys.exc_info()[:2]
-                       if value!=None:
-                               print
-                               print traceback.print_exc(file=sys.stdout)
+                       if print_traceback:
+                               (type,value)=sys.exc_info()[:2]
+                               if value!=None:
+                                       print
+                                       print "Traceback valuse found.  
listing..."
+                                       print 
traceback.print_exc(file=sys.stdout)
                        print
                        print "!!! catalyst: "+message
                        print
@@ -147,17 +148,17 @@ def file_locate(settings,filelist,expand=1):
                        #filenames such as cdtar are optional, so we don't 
assume the variable is defined.
                        pass
                else:
-                       if len(settings[myfile])==0:
-                               raise CatalystError("File variable \"" + myfile 
+
-                                       "\" has a length of zero (not 
specified.)")
-                       if settings[myfile][0]=="/":
-                               if not os.path.exists(settings[myfile]):
-                                       raise CatalystError("Cannot locate 
specified " + myfile +
-                                               ": "+settings[myfile])
-                       elif expand and 
os.path.exists(os.getcwd()+"/"+settings[myfile]):
-                               
settings[myfile]=os.getcwd()+"/"+settings[myfile]
-                       else:
-                               raise CatalystError("Cannot locate specified " 
+ myfile +
+                   if len(settings[myfile])==0:
+                           raise CatalystError("File variable \"" + myfile +
+                                       "\" has a length of zero (not 
specified.)", print_traceback=True)
+                   if settings[myfile][0]=="/":
+                           if not os.path.exists(settings[myfile]):
+                                   raise CatalystError("Cannot locate 
specified " + myfile +
+                                               ": "+settings[myfile], 
print_traceback=True)
+                   elif expand and 
os.path.exists(os.getcwd()+"/"+settings[myfile]):
+                           settings[myfile]=os.getcwd()+"/"+settings[myfile]
+                   else:
+                           raise CatalystError("Cannot locate specified " + 
myfile +
                                        ": "+settings[myfile]+" (2nd try)" +
 """
 Spec file format:
@@ -178,9 +179,8 @@ would contain an ordered list as well: [ "meep", "bark", 
"gleep", "moop" ]. It's
 that the order of multiple-value items is preserved, but the order that the 
items themselves are
 defined are not preserved. In other words, "foo", "bar", "oni" ordering is 
preserved but "item1"
 "item2" "item3" ordering is not, as the item strings are stored in a 
dictionary (hash).
-"""
-                                       )
-
+""",
+                                       print_traceback=True)
 
 def parse_makeconf(mylines):
        mymakeconf={}
@@ -225,7 +225,8 @@ def read_makeconf(mymakeconffile):
                                                myf.close()
                                                return parse_makeconf(mylines)
                except:
-                       raise CatalystError, "Could not parse make.conf file 
"+mymakeconffile
+                       raise CatalystError("Could not parse make.conf file " +
+                               mymakeconffile, print_traceback=True)
        else:
                makeconf={}
                return makeconf
@@ -279,7 +280,7 @@ def addl_arg_parse(myspec,addlargs,requiredspec,validspec):
                        messages.append("Required argument \""+x+"\" not 
specified.")
 
        if messages:
-               raise CatalystError, '\n\tAlso: '.join(messages)
+               raise CatalystError('\n\tAlso: '.join(messages))
 
 
 def touch(myfile):
@@ -287,7 +288,7 @@ def touch(myfile):
                myf=open(myfile,"w")
                myf.close()
        except IOError:
-               raise CatalystError, "Could not touch "+myfile+"."
+               raise CatalystError("Could not touch "+myfile+".", 
print_traceback=True)
 
 
 def countdown(secs=5, doing="Starting"):

diff --git a/catalyst/targets/grp.py b/catalyst/targets/grp.py
index 0075714..93d30fc 100644
--- a/catalyst/targets/grp.py
+++ b/catalyst/targets/grp.py
@@ -25,7 +25,7 @@ class grp(StageBase):
                self.valid_values=self.required_values[:]
                self.valid_values.extend(["grp/use"])
                if "grp" not in addlargs:
-                       raise CatalystError,"Required value \"grp\" not 
specified in spec."
+                       raise CatalystError("Required value \"grp\" not 
specified in spec.")
 
                self.required_values.extend(["grp"])
                if type(addlargs["grp"])==types.StringType:
@@ -66,7 +66,8 @@ class grp(StageBase):
 
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"GRP build aborting due to 
error."
+                               raise CatalystError("GRP build aborting due to 
error.",
+                                       print_traceback=True)
 
        def set_use(self):
                StageBase.set_use(self)

diff --git a/catalyst/targets/livecd_stage1.py 
b/catalyst/targets/livecd_stage1.py
index 661e06e..6cbd91a 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -7,6 +7,7 @@ import os
 import types
 import string
 
+
 from catalyst.support import (normpath,
        touch, cmd)
 
@@ -45,9 +46,6 @@ class livecd_stage1(StageBase):
                        if not os.path.exists(self.settings["target_path"]):
                                os.makedirs(self.settings["target_path"])
 
-       def set_target_path(self):
-               pass
-
        def set_spec_prefix(self):
                        self.settings["spec_prefix"]="livecd"
 

diff --git a/catalyst/targets/livecd_stage2.py 
b/catalyst/targets/livecd_stage2.py
index 20f6014..949ee98 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -44,7 +44,9 @@ class livecd_stage2(StageBase):
                else:
                        
self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/")
                if not os.path.exists(self.settings["source_path"]):
-                       raise CatalystError,"Source Path: 
"+self.settings["source_path"]+" does not exist."
+                       raise CatalystError("Source Path: " +
+                               self.settings["source_path"] + " does not 
exist.",
+                                       print_traceback=True)
 
        def set_spec_prefix(self):
            self.settings["spec_prefix"]="livecd"
@@ -70,7 +72,10 @@ class livecd_stage2(StageBase):
                                
myf=open(self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf","a")
                        except:
                                self.unbind()
-                               raise CatalystError,"Couldn't open 
"+self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf."
+                               raise CatalystError("Couldn't open " +
+                                       self.settings["chroot_path"] +
+                                       "/etc/modprobe.d/blacklist.conf.",
+                                       print_traceback=True)
 
                        myf.write("\n#Added by Catalyst:")
                        # workaround until config.py is using configparser
@@ -122,7 +127,10 @@ class livecd_stage2(StageBase):
                                        
os.makedirs(self.settings["pkgcache_path"],0755)
 
                        if not display_msg:
-                               raise CatalystError,"Could not find appropriate 
source. Please check the 'source_subpath' setting in the spec file."
+                               raise CatalystError("Could not find appropriate 
source.\n"
+                                       "Please check the 'source_subpath' "
+                                       "setting in the spec file.",
+                                       print_traceback=True)
 
                        print display_msg
                        cmd(unpack_cmd,error_msg,env=self.env)

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index f753c7f..7ae1d75 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -6,6 +6,7 @@ netboot target, version 1
 import os
 import types
 
+
 from catalyst.support import (CatalystError, normpath,
        cmd, list_bashify, file_locate)
 
@@ -39,7 +40,7 @@ class netboot(StageBase):
                #       for x in loopy:
                #               
self.required_values.append("netboot/packages/"+x+"/files")
                except:
-                       raise CatalystError,"configuration error in 
netboot/packages."
+                       raise CatalystError("configuration error in 
netboot/packages.")
 
                StageBase.__init__(self,spec,addlargs)
                self.set_build_kernel_vars(addlargs)
@@ -67,7 +68,8 @@ class netboot(StageBase):
 #                      cmd(self.settings["controller_file"]+" packages 
"+mypack,env=self.env)
 #              except CatalystError:
 #                      self.unbind()
-#                      raise CatalystError,"netboot build aborting due to 
error."
+#                      raise CatalystError("netboot build aborting due to 
error.",
+#                                      print_traceback=True)
 
        def build_busybox(self):
                # build busybox
@@ -79,7 +81,8 @@ class netboot(StageBase):
                        cmd(self.settings["controller_file"]+" busybox "+ 
mycmd,env=self.env)
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"netboot build aborting due to 
error."
+                       raise CatalystError("netboot build aborting due to 
error.",
+                               print_traceback=True)
 
        def copy_files_to_image(self):
                # create image
@@ -108,7 +111,8 @@ class netboot(StageBase):
                                " image " + list_bashify(myfiles),env=self.env)
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"netboot build aborting due to 
error."
+                       raise CatalystError("netboot build aborting due to 
error.",
+                               print_traceback=True)
 
        def create_netboot_files(self):
                # finish it all up
@@ -116,7 +120,8 @@ class netboot(StageBase):
                        cmd(self.settings["controller_file"]+" 
finish",env=self.env)
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"netboot build aborting due to 
error."
+                       raise CatalystError("netboot build aborting due to 
error.",
+                               print_traceback=True)
 
                # end
                print "netboot: build finished !"

diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
index fc8c64c..dbbb6a9 100644
--- a/catalyst/targets/netboot2.py
+++ b/catalyst/targets/netboot2.py
@@ -43,7 +43,7 @@ class netboot2(StageBase):
                                for x in loopy:
                                        
self.valid_values.append("netboot2/packages/"+x+"/files")
                except:
-                       raise CatalystError,"configuration error in 
netboot2/packages."
+                       raise CatalystError("configuration error in 
netboot2/packages.")
 
                StageBase.__init__(self,spec,addlargs)
                self.set_build_kernel_vars()
@@ -98,7 +98,8 @@ class netboot2(StageBase):
                                        " image " + 
list_bashify(myfiles),env=self.env)
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"Failed to copy files to 
image!"
+                               raise CatalystError("Failed to copy files to 
image!",
+                                       print_traceback=True)
 
                        
touch(self.settings["autoresume_path"]+"copy_files_to_image")
 
@@ -124,7 +125,8 @@ class netboot2(StageBase):
                        print ">>> Netboot Build Finished!"
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"Failed to move kernel images!"
+                       raise CatalystError("Failed to move kernel images!",
+                               print_traceback=True)
 
        def remove(self):
                if "autoresume" in self.settings["options"] \

diff --git a/catalyst/targets/tinderbox.py b/catalyst/targets/tinderbox.py
index 4cb7537..59e85d0 100644
--- a/catalyst/targets/tinderbox.py
+++ b/catalyst/targets/tinderbox.py
@@ -29,7 +29,8 @@ class tinderbox(StageBase):
 
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"Tinderbox aborting due to error."
+                       raise CatalystError("Tinderbox aborting due to error.",
+                               print_traceback=True)
 
        def set_cleanables(self):
                self.settings['cleanables'] = [

diff --git a/targets/stage1/build.py b/targets/stage1/build.py
index bf20bcf..b2c8b0f 100755
--- a/targets/stage1/build.py
+++ b/targets/stage1/build.py
@@ -1,6 +1,8 @@
 #!/usr/bin/python
 
-import os,portage,sys
+import os
+import sys
+import portage
 
 # this loads files from the profiles ...
 # wrap it here to take care of the different

Reply via email to