[yum-git] Makefile package-cleanup.py test/yum-utils-pylintrc

Tim Lauridsen timlau at linux.duke.edu
Wed Sep 24 11:08:06 UTC 2008


 Makefile                |    2 +-
 package-cleanup.py      |   18 +++++++++---------
 test/yum-utils-pylintrc |    8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit cb3e4f750997ddfdbc2348ac8f68751041687e5b
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date:   Wed Sep 24 13:07:49 2008 +0200

    add package-cleanup.py to pylint check and cleaned it up

diff --git a/Makefile b/Makefile
index 1207910..bfd638f 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,6 @@ ChangeLog: FORCE
 pylint:
 	@pylint --rcfile=test/yum-utils-pylintrc \
 		yumdownloader.py yum-complete-transaction.py yum-debug-dump.py yum-builddep.py \
-                debuginfo-install.py
+                debuginfo-install.py package-cleanup.py
 	
 FORCE:	
diff --git a/package-cleanup.py b/package-cleanup.py
index 152e873..aab5ed0 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -29,7 +29,6 @@ import re
 
 from rpmUtils import miscutils, transaction
 from optparse import OptionParser
-from yum.packages import YumInstalledPackage
 from yum import Errors
 from yum.misc import getCacheDir
 
@@ -65,7 +64,7 @@ def getLocalRequires(my):
     pkgs = {}
     for po in my.rpmdb.returnPackages():
         tup = po.pkgtup
-        header= po.hdr
+        header = po.hdr
         requires = zip(
             header[rpm.RPMTAG_REQUIRENAME],
             header[rpm.RPMTAG_REQUIREFLAGS],
@@ -87,7 +86,8 @@ def buildProviderList(my, pkgs, reportProblems):
             if ver == '':
                 ver = None
             rflags = flags & 15
-            if req.startswith('rpmlib'): continue # ignore rpmlib deps
+            if req.startswith('rpmlib'):
+                continue # ignore rpmlib deps
             
             if not providers.has_key((req,rflags,ver)):
                 resolve_sack = my.rpmdb.whatProvides(req,rflags,ver)
@@ -150,7 +150,7 @@ def printDupes(my):
         for (e,v,r) in dupedict[(n,a)]:
             po = my.getInstalledPackageObject((n,a,e,v,r))
             if po.name.startswith('kernel'):
-               continue
+                continue
             if po.name == 'gpg-pubkey':
                 continue
             dupes.append(po)
@@ -226,14 +226,14 @@ def _shouldShowLeaf(my, pkg, leaf_regex, exclude_devel, exclude_bin):
         return True
     return False
 
-def listLeaves(my, all, leaf_regex, exclude_devel, exclude_bin):
+def listLeaves(my, all_nodes, leaf_regex, exclude_devel, exclude_bin):
     """return a packagtuple of any installed packages that
        are not required by any other package on the system"""
     ts = transaction.initReadOnlyTransaction()
     leaves = ts.returnLeafNodes()
     for pkg in leaves:
-        name=pkg[0]
-        if all or _shouldShowLeaf(my, pkg, leaf_regex, exclude_devel,
+        name = pkg[0]
+        if all_nodes or _shouldShowLeaf(my, pkg, leaf_regex, exclude_devel,
                 exclude_bin):
             print "%s-%s-%s.%s" % (pkg[0],pkg[3],pkg[4],pkg[1])
 
@@ -370,7 +370,7 @@ def parseArgs():
     # Leaf listing options
     parser.add_option("--leaves", default=False, dest="leaves",action="store_true",
       help='List leaf nodes in the local RPM database')
-    parser.add_option("--all", default=False, dest="all",action="store_true",
+    parser.add_option("--all", default=False, dest="all_nodes",action="store_true",
       help='When listing leaf nodes also list leaf nodes that do not match leaf-regex')
     parser.add_option("--leaf-regex", default="(^(compat-)?lib.+|.*libs?[\d-]*$)",
       help='A package name that matches this regular expression (case insensitively) is a leaf')
@@ -420,7 +420,7 @@ def main():
         sys.exit(0)
     
     if (opts.leaves):
-        listLeaves(my, opts.all, re.compile(opts.leaf_regex, re.IGNORECASE),
+        listLeaves(my, opts.all_nodes, re.compile(opts.leaf_regex, re.IGNORECASE),
                 opts.exclude_devel, opts.exclude_bin)
         sys.exit(0)
 
diff --git a/test/yum-utils-pylintrc b/test/yum-utils-pylintrc
index d9a78f5..ebb4a2f 100644
--- a/test/yum-utils-pylintrc
+++ b/test/yum-utils-pylintrc
@@ -53,7 +53,6 @@ load-plugins=
 #enable-msg=
 
 # Disable the message(s) with the given id(s).
-# W0401: *Wildcard import %s* 
 # C0324: *Comma not followed by a space* 
 # C0301: *Line too long (%s/%s)*
 # C0111: *Missing docstring* (to bad, but off for now)
@@ -64,7 +63,8 @@ load-plugins=
 # W0612: *Unused variable %r* ( dont care if x,y,z = f() and y,z is not used) 
 # W0212: *Access to a protected member %s of a client class*  (if sucks, but we do that a lot)
 # R0801: *Similar lines in %s files* (this is fine, some utils look alike)
-disable-msg=C0324,C0301,C0111,E1101,F0401,R0201,W0704,W0612,W0212,R0801
+# W0613: *Unused argument %r* 
+disable-msg=C0324,C0301,C0111,E1101,F0401,R0201,W0704,W0612,W0212,R0801,W0613
 
 
 [REPORTS]
@@ -150,13 +150,13 @@ variable-rgx=[a-z_][a-z0-9_A-Z]{1,30}$
 inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
 
 # Good variable names which should always be accepted, separated by a comma
-good-names=i,j,k,ex,Run,_,n,e,r,v,a,po,f,m,u
+good-names=i,j,k,ex,Run,_,n,e,r,v,a,po,f,m,u,h,l
 
 # Bad variable names which should always be refused, separated by a comma
 bad-names=foo,bar,baz,toto,tutu,tata
 
 # List of builtins function names that should not be used, separated by a comma
-bad-functions=map,filter,apply,input
+bad-functions=apply,input
 
 
 # checks for



More information about the Yum-cvs-commits mailing list