Small cleanups to make pychecker happy
authorAndrew Gaffney <agaffney@gentoo.org>
Mon, 12 Jan 2009 00:02:38 +0000 (18:02 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Mon, 12 Jan 2009 00:02:38 +0000 (18:02 -0600)
23 files changed:
ChangeLog
modules/catalyst/__init__.py
modules/catalyst/arch/__init__.py
modules/catalyst/arch/alpha.py
modules/catalyst/arch/arm.py
modules/catalyst/arch/hppa.py
modules/catalyst/arch/ia64.py
modules/catalyst/arch/mips.py
modules/catalyst/arch/s390.py
modules/catalyst/arch/sh.py
modules/catalyst/config.py
modules/catalyst/error.py
modules/catalyst/hash.py
modules/catalyst/output.py
modules/catalyst/spawn.py
modules/catalyst/support.py
modules/catalyst/target/__init__.py
modules/catalyst/target/embedded.py
modules/catalyst/target/generic_stage.py
modules/catalyst/target/livecd_stage1.py
modules/catalyst/target/livecd_stage2.py
modules/catalyst/target/netboot.py
modules/catalyst/util.py

index 42ad6a9149c3d6f03fc74afaada53968cda77866..931b897eb4a07e347a57b91203c56acdede0c755 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,22 @@
 # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
 # Distributed under the GPL v2
 
+  12 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst/__init__.py, modules/catalyst/arch/__init__.py,
+  modules/catalyst/arch/alpha.py, modules/catalyst/arch/arm.py,
+  modules/catalyst/arch/hppa.py, modules/catalyst/arch/ia64.py,
+  modules/catalyst/arch/mips.py, modules/catalyst/arch/s390.py,
+  modules/catalyst/arch/sh.py, modules/catalyst/config.py,
+  modules/catalyst/error.py, modules/catalyst/hash.py,
+  modules/catalyst/output.py, modules/catalyst/spawn.py,
+  modules/catalyst/support.py, modules/catalyst/target/__init__.py,
+  modules/catalyst/target/embedded.py,
+  modules/catalyst/target/generic_stage.py,
+  modules/catalyst/target/livecd_stage1.py,
+  modules/catalyst/target/livecd_stage2.py,
+  modules/catalyst/target/netboot.py, modules/catalyst/util.py:
+  Small cleanups to make pychecker happy
+
   11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst/support.py, modules/catalyst/util.py:
   import cleanups
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ec0b62d87d7390f8d4a3fac41eddef128ebab0fe 100644 (file)
@@ -0,0 +1,15 @@
+import catalyst.hash
+import catalyst.arch
+import catalyst.lock
+import catalyst.util
+import catalyst.error
+import catalyst.spawn
+import catalyst.target
+
+hash = catalyst.hash
+arch = catalyst.arch
+lock = catalyst.lock
+util = catalyst.util
+error = catalyst.error
+spawn = catalyst.spawn
+target = catalyst.target
index c934986e6a22faf88cdf597b0cdc2fa137ec6e5e..99628edabdc444fcbd97c0f2ba7ab6f6f0a41475 100644 (file)
@@ -3,17 +3,16 @@ Parent module of all arch modules
 """
 
 import os
-import imp
 import catalyst.util
 from catalyst.output import warn
 
-def find_arch_modules(self):
+def find_arch_modules():
        search_dir = os.path.abspath(os.path.dirname(__file__))
        arch_module_list = [x[:-3] for x in os.listdir(search_dir) \
                if x.endswith('.py') and not x.startswith('__')]
        return arch_module_list
 
-def get_arches(self):
+def get_arches():
        arch_modules = {}
        for x in find_arch_modules():
                arch_modules[x] = catalyst.util.load_module("catalyst.arch." + x)
index 9bcf229fd7837d17305fbac908aef5f3be195db3..ec8c9e046539df62b24a8ed8219411b9a17ca33d 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class generic_alpha(catalyst.arch.generic_arch):
index e4bc2c52fb7a7c3de4843ef52a81519e86610c3d..1599f2ddf1e0ff19148c2976521454d06589647e 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class generic_arm(catalyst.arch.generic_arch):
index be382cbc3d40b7b8fe1f5ed6f28d87e676a71197..39c38d22f85eceaa873329f2a6c9350d7c3fa794 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class generic_hppa(catalyst.arch.generic_arch):
index cf74a8a611b4557829674b9784b5dba77e063c7e..ceffff4a7c9d60ccb183161c3597c9596726e09e 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class arch_ia64(catalyst.arch.generic_arch):
index de0ab3e107a00c7add79167d3ccecad2fbcbcb9f..9b2f30a70350926e6736a6ad26c01ab9911c280b 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class generic_mips(catalyst.arch.generic_arch):
index 6c652c4ca2950fa249762272410d33438f61328b..ba8d8a63eddeb50d328e5d587cdee6b630dd3191 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class generic_s390(catalyst.arch.generic_arch):
index 0c7690badce737d3c0d32aee3324a5124df18ade..485feb375566f45f27ebda28de77bff4cfaf902e 100644 (file)
@@ -1,5 +1,5 @@
 
-import catalyst.arch,os
+import catalyst.arch
 from catalyst.support import *
 
 class generic_sh(catalyst.arch.generic_arch):
index 746a2c6846c7df80f42ae127b647f429896e459d..ba9d03d14a4b3a7913f506106b78e6882fdde3d8 100644 (file)
@@ -41,7 +41,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()
index cc22e9b6da43a724fb9d611737299fa65f5c6bcb..66ab3e0c5e31c252569d41815ad8011f0aeb4fff 100644 (file)
@@ -8,7 +8,7 @@ import catalyst.output
 class CatalystError(Exception):
        def __init__(self, message):
                if message:
-                       (type,value)=sys.exc_info()[:2]
+                       (extype,value)=sys.exc_info()[:2]
                        if value!=None:
                                print
                                print traceback.print_exc(file=sys.stdout)
@@ -19,7 +19,7 @@ class CatalystError(Exception):
 class LockInUse(Exception):
        def __init__(self, message):
                if message:
-                       #(type,value)=sys.exc_info()[:2]
+                       #(extype,value)=sys.exc_info()[:2]
                        #if value!=None:
                            #print
                            #kprint traceback.print_exc(file=sys.stdout)
index 7392010e5402703f1db9997425768c7738022d7d..bdcb0997f54f1ea8c7d0523198e1b8cffa27bbc7 100644 (file)
@@ -4,6 +4,7 @@ This module contains functions for generating the CONTENTS and hash files
 
 import os
 from catalyst.error import *
+from catalyst.output import warn
 
 def generate_contents(file, contents_function="auto", verbose=False):
        try:
@@ -75,9 +76,9 @@ def calc_hash2(file, cmd, cmd_args, id_string="MD5", verbose=False):
        header = a.readline()
        myline = a.readline().split()
        a.close()
-       hash = myline[0]
+       tmphash = myline[0]
        short_file = os.path.split(myline[1])[1]
-       result = header + hash + "  " + short_file + "\n"
+       result = header + tmphash + "  " + short_file + "\n"
        if verbose:
                print "%s (%s) = %s" % (header, short_file, result)
        return result
index 27dac0a450d7f9d31baf66f36d5f47e27f08dd46..e3030eb48e449735569aad9eb6353cf44f952fba 100644 (file)
@@ -4,6 +4,8 @@ This module contains miscellaneous functions for outputting messages
 
 import sys
 
+verbosity = 1
+
 def msg(mymsg, verblevel=1):
        if verbosity >= verblevel:
                print mymsg
index bfd76612fa23339b0c07d247bbb0265631393d93..7f26cd7dbb7341d2f67c76c3bf0d72a6452e9672 100644 (file)
@@ -2,7 +2,7 @@
 This module contains all the functions related to spawning external commands
 """
 
-import sys, os, types
+import sys, os, types, signal
 import catalyst.util
 from catalyst.error import *
 
@@ -14,7 +14,7 @@ selinux_capable = False
 
 try:
        import resource
-       max_fd_limit=resource.getrlimit(RLIMIT_NOFILE)
+       max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)
 except SystemExit, e:
        raise
 except:
index e2d7afe60566a227daaacda4685b6b965bcf9b2f..5e19634926fb959db730aec0075fe83d2b662e26 100644 (file)
@@ -24,8 +24,6 @@ valid_config_file_values.append("digests")
 valid_config_file_values.append("contents")
 valid_config_file_values.append("SEEDCACHE")
 
-verbosity=1
-
 """
 Spec file format:
 
index 8e23b5219d3744e47b3a7bb2f550b7ab9fa4269a..8688e0814584e040064b968e4651d57266e8c90b 100644 (file)
@@ -3,7 +3,6 @@ Parent module of all target modules
 """
 
 import os
-import imp
 import catalyst.util
 from catalyst.output import warn
 
index 5a3bc4bfa808e98ffb92dca43afd821fdc368a99..c116dedafeb46dbd65b4c8ae2f8d043137fdd911 100644 (file)
@@ -24,7 +24,7 @@ class embedded_target(generic_stage_target):
                        self.valid_values.append("embedded/fs-ops")
 
                generic_stage_target.__init__(self,spec,addlargs)
-               self.set_build_kernel_vars(addlargs)
+               self.set_build_kernel_vars()
 
        def set_action_sequence(self):
                self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
index 222f586cedb47ff9c160bbf3d2b36950c22512f5..9688077a18637f6599c0f106bee695c28de13fd4 100644 (file)
@@ -4,7 +4,7 @@ This class does all of the chroot setup, copying of files, etc. It is
 the driver class for pretty much everything that Catalyst does.
 """
 
-import os,string,imp,types,shutil
+import os, string, types, shutil
 from catalyst.support import *
 from catalyst.target.generic import *
 from stat import *
@@ -1609,15 +1609,15 @@ class generic_stage_target(generic_target):
                                for f in [file, file+'.CONTENTS']:
                                        if os.path.exists(f):
                                                if "all" in array:
-                                                       for k in hash_map.keys():
-                                                               hash=catalyst.hash.generate_hash(f,hash_function=k,verbose=\
+                                                       for k in catalyst.hash.hash_map.keys():
+                                                               tmphash=catalyst.hash.generate_hash(f,hash_function=k,verbose=\
                                                                        ("VERBOSE" in self.settings))
-                                                               myf.write(hash)
+                                                               myf.write(tmphash)
                                                else:
                                                        for j in array:
-                                                               hash=catalyst.hash.generate_hash(f,hash_function=j,verbose=\
+                                                               tmphash=catalyst.hash.generate_hash(f,hash_function=j,verbose=\
                                                                        ("VERBOSE" in self.settings))
-                                                               myf.write(hash)
+                                                               myf.write(tmphash)
                                myf.close()
 
        def purge(self):
index 65d73b979a195b2553cd54c335c82d4eba1ea26a..5cbc73fccaefe11d8baf7f2219c957319076a0e4 100644 (file)
@@ -21,6 +21,7 @@ class livecd_stage1_target(generic_stage_target):
                                        "config_profile_link","setup_confdir","portage_overlay",\
                                        "bind","chroot_setup","setup_environment","build_packages",\
                                        "unbind", "clean","clear_autoresume"]
+
        def set_target_path(self):
                self.settings["target_path"]=catalyst.util.normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
                if "AUTORESUME" in self.settings \
@@ -39,8 +40,9 @@ class livecd_stage1_target(generic_stage_target):
 
        def set_target_path(self):
                pass
+
        def set_spec_prefix(self):
-                       self.settings["spec_prefix"]="livecd"
+               self.settings["spec_prefix"]="livecd"
 
        def set_use(self):
                generic_stage_target.set_use(self)
index 8ad662e7a0e889dd670fb7ab19420bc84dd5a1f6..6d21529335e991673e6accf1c5915207b7bdee30 100644 (file)
@@ -3,7 +3,7 @@
 Builder class for a LiveCD stage2 build.
 """
 
-import os,string,types,stat,shutil
+import os
 from catalyst.support import *
 from generic_stage import *
 import catalyst.util
index e1a87ae9c7c92844891a14dc4dbd892adf17d4b2..e93d086433c6fe0446ef42001fc779067b2a4e8a 100644 (file)
@@ -40,7 +40,7 @@ class netboot_target(generic_stage_target):
 
 
                generic_stage_target.__init__(self,spec,addlargs)
-               self.set_build_kernel_vars(addlargs)
+               self.set_build_kernel_vars()
                if "netboot/busybox_config" in addlargs:
                        catalyst.util.file_locate(self.settings, ["netboot/busybox_config"])
 
index 25823a25f6a575fc1c9094ad69824536d8f72688..8fa9ac31bfd59267584410a7c0cf3bc07aad126d 100644 (file)
@@ -2,7 +2,7 @@
 Collection of utility functions for catalyst
 """
 
-import sys, traceback, os, os.path, re
+import sys, traceback, os, os.path, re, time
 from catalyst.error import *
 
 def capture_traceback():