]> err.no Git - dak/commitdiff
clean up pychecker warnings
authorMark Hymers <mhy@debian.org>
Sat, 3 May 2008 15:24:02 +0000 (16:24 +0100)
committerMark Hymers <mhy@debian.org>
Sat, 3 May 2008 15:24:02 +0000 (16:24 +0100)
dak/examine_package.py

index 5080d3482b3876e6f4de6297769a83f19aa6ccd6..47be7f654db3c0f27d08089fddacd300492ceef2 100644 (file)
@@ -350,28 +350,28 @@ def do_lintian (filename):
 def print_copyright (deb_filename):
     package = re_package.sub(r'\1', deb_filename)
     o = os.popen("dpkg-deb -c %s | egrep 'usr(/share)?/doc/[^/]*/copyright' | awk '{print $6}' | head -n 1" % (deb_filename))
-    copyright = o.read()[:-1]
+    cright = o.read()[:-1]
 
-    if copyright == "":
+    if cright == "":
         print_formatted_text("WARNING: No copyright found, please check package manually.")
         return
 
-    doc_directory = re_doc_directory.sub(r'\1', copyright)
+    doc_directory = re_doc_directory.sub(r'\1', cright)
     if package != doc_directory:
         print_formatted_text("WARNING: wrong doc directory (expected %s, got %s)." % (package, doc_directory))
         return
 
-    o = os.popen("dpkg-deb --fsys-tarfile %s | tar xvOf - %s 2>/dev/null" % (deb_filename, copyright))
-    copyright = o.read()
-    copyrightmd5 = md5.md5(copyright).hexdigest()
+    o = os.popen("dpkg-deb --fsys-tarfile %s | tar xvOf - %s 2>/dev/null" % (deb_filename, cright))
+    cright = o.read()
+    crightmd5 = md5.md5(cright).hexdigest()
 
-    if printed_copyrights.has_key(copyrightmd5) and printed_copyrights[copyrightmd5] != "%s (%s)" % (package, deb_filename):
+    if printed_copyrights.has_key(crightmd5) and printed_copyrights[crightmd5] != "%s (%s)" % (package, deb_filename):
         print_formatted_text( "NOTE: Copyright is the same as %s.\n" % \
-                (printed_copyrights[copyrightmd5]))
+                (printed_copyrights[crightmd5]))
     else:
-        printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename)
+        printed_copyrights[crightmd5] = "%s (%s)" % (package, deb_filename)
 
-    print_formatted_text(copyright)
+    print_formatted_text(cright)
 
 def check_dsc (dsc_filename):
     headline(".dsc file for %s" % (dsc_filename))
@@ -414,11 +414,11 @@ def check_deb (deb_filename):
 # Read a file, strip the signature and return the modified contents as
 # a string.
 def strip_pgp_signature (filename):
-    file = daklib.utils.open_file (filename)
+    f = daklib.utils.open_file (filename)
     contents = ""
     inside_signature = 0
     skip_next = 0
-    for line in file.readlines():
+    for line in f.readlines():
         if line[:-1] == "":
             continue
         if inside_signature:
@@ -436,7 +436,7 @@ def strip_pgp_signature (filename):
             inside_signature = 0
             continue
         contents += line
-    file.close()
+    f.close()
     return contents
 
 # Display the .changes [without the signature]
@@ -449,11 +449,11 @@ def check_changes (changes_filename):
 
     changes = daklib.utils.parse_changes (changes_filename)
     files = daklib.utils.build_file_list(changes)
-    for file in files.keys():
-        if file.endswith(".deb") or file.endswith(".udeb"):
-            check_deb(file)
-        if file.endswith(".dsc"):
-            check_dsc(file)
+    for f in files.keys():
+        if f.endswith(".deb") or f.endswith(".udeb"):
+            check_deb(f)
+        if f.endswith(".dsc"):
+            check_dsc(f)
         # else: => byhand
 
 def main ():
@@ -476,7 +476,7 @@ def main ():
 
     stdout_fd = sys.stdout
 
-    for file in args:
+    for f in args:
         try:
             if not Options["Html-Output"]:
                 # Pipe output for each argument through less
@@ -484,21 +484,21 @@ def main ():
                 # -R added to display raw control chars for colour
                 sys.stdout = less_fd
             try:
-                if file.endswith(".changes"):
-                    check_changes(file)
-                elif file.endswith(".deb") or file.endswith(".udeb"):
-                    check_deb(file)
-                elif file.endswith(".dsc"):
-                    check_dsc(file)
+                if f.endswith(".changes"):
+                    check_changes(f)
+                elif f.endswith(".deb") or f.endswith(".udeb"):
+                    check_deb(f)
+                elif f.endswith(".dsc"):
+                    check_dsc(f)
                 else:
-                    daklib.utils.fubar("Unrecognised file type: '%s'." % (file))
+                    daklib.utils.fubar("Unrecognised file type: '%s'." % (f))
             finally:
                 if not Options["Html-Output"]:
                     # Reset stdout here so future less invocations aren't FUBAR
                     less_fd.close()
                     sys.stdout = stdout_fd
         except IOError, e:
-            if errno.errorcode[e.errno] == 'EPIPE':
+            if e.errno == errno.EPIPE:
                 daklib.utils.warn("[examine-package] Caught EPIPE; skipping.")
                 pass
             else: