pychecker warning cleanups
authorGuido Günther <agx@sigxcpu.org>
Sun, 26 Dec 2010 21:07:28 +0000 (22:07 +0100)
committerGuido Günther <agx@sigxcpu.org>
Mon, 27 Dec 2010 23:15:13 +0000 (00:15 +0100)
(mostly unused variables and imports)

gbp-pull
gbp/config.py
git-buildpackage
git-dch
git-import-dsc
git-import-dscs
git-import-orig

index f8aa9c8..e7d9815 100755 (executable)
--- a/gbp-pull
+++ b/gbp-pull
@@ -65,7 +65,6 @@ def fast_forward_branch(branch, repo, options):
     return update
 
 def main(argv):
-    changelog = 'debian/changelog'
     retval = 0
 
     parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
index 134d64f..c989afe 100644 (file)
@@ -167,7 +167,7 @@ class GbpOptionParser(OptionParser):
         self.__parse_config_files()
         OptionParser.__init__(self, option_class=GbpOption, usage=usage, version='%s %s' % (self.command, gbp_version))
 
-    def _is_boolean(self, option_name, *args, **kwargs):
+    def _is_boolean(self, dummy, *unused, **kwargs):
         """is option_name a boolean option"""
         ret = False
         try:
index 12bb029..42049d3 100755 (executable)
@@ -27,7 +27,7 @@ import time
 import gbp.deb as du
 from gbp.git import (GitRepositoryError, GitRepository, build_tag)
 from gbp.command_wrappers import (GitTag, Command, RunAtCommand, CommandExecFailed,
-                                  PristineTar, RemoveTree, GitAdd, PristineTar)
+                                  PristineTar, RemoveTree, GitAdd)
 from gbp.config import (GbpOptionParser, GbpOptionGroup)
 from gbp.errors import GbpError
 from glob import glob
@@ -150,7 +150,7 @@ def write_wc(repo):
     os.unsetenv("GIT_INDEX_FILE")
     return tree
 
-def drop_index(repo):
+def drop_index():
     """drop our custom index"""
     if os.path.exists(wc_index):
         os.unlink(wc_index)
@@ -437,7 +437,7 @@ def main(argv):
             gbp.log.err(err)
         retval = 1
     finally:
-        drop_index(repo)
+        drop_index()
 
     if not options.tag_only:
         if options.export_dir and options.purge and not retval:
diff --git a/git-dch b/git-dch
index cb15742..69c2792 100755 (executable)
--- a/git-dch
+++ b/git-dch
@@ -31,7 +31,6 @@ from gbp.git import (GitRepositoryError, GitRepository, build_tag, tag_to_versio
 from gbp.config import GbpOptionParser, GbpOptionGroup
 from gbp.errors import GbpError
 from gbp.deb import parse_changelog, NoChangelogError, is_native, compare_versions
-from gbp.command_wrappers import (Command, CommandExecFailed)
 
 user_customizations = {}
 snapshot_re = re.compile("\s*\*\* SNAPSHOT build @(?P<commit>[a-z0-9]+)\s+\*\*")
@@ -39,8 +38,8 @@ snapshot_re = re.compile("\s*\*\* SNAPSHOT build @(?P<commit>[a-z0-9]+)\s+\*\*")
 
 def system(cmd):
     try:
-        Command(cmd, shell=True)()
-    except CommandExecFailed:
+        gbpc.Command(cmd, shell=True)()
+    except gbpc.CommandExecFailed:
         raise GbpError
 
 
@@ -292,7 +291,7 @@ def process_options(options, parser):
     return dch_options
 
 
-def process_editor_option(options, parser):
+def process_editor_option(options):
     # Determine Editor and check if we need it
     states = ['always']
 
@@ -312,7 +311,6 @@ def main(argv):
     changelog = 'debian/changelog'
     until = 'HEAD'
     found_snapshot_header = False
-    first_commit = None
     version_change = {}
 
     try:
@@ -382,7 +380,7 @@ def main(argv):
     (options, args) = parser.parse_args(argv[1:])
     gbp.log.setup(options.color, options.verbose)
     dch_options = process_options(options, parser)
-    editor_cmd = process_editor_option(options, parser)
+    editor_cmd = process_editor_option(options)
 
     try:
         try:
index db15e4c..9c96f02 100755 (executable)
@@ -59,9 +59,8 @@ def download_source(pkg, dirs):
     return dsc
 
 
-def apply_patch(diff, unpack_dir):
+def apply_patch(diff):
     "Apply patch to a source tree"
-    d = os.path.abspath(unpack_dir)
     pipe = pipes.Template()
     pipe.prepend('gunzip -c %s' % diff,  '.-')
     pipe.append('patch -p1 --quiet', '-.')
@@ -76,9 +75,9 @@ def apply_patch(diff, unpack_dir):
     return True
 
 
-def apply_deb_tgz(deb_tgz, unpack_dir):
+def apply_deb_tgz(deb_tgz):
     """Apply .debian.tar.gz (V3 source format)"""
-    unpackArchive = gbpc.UnpackTarArchive(deb_tgz, ".")()
+    gbpc.UnpackTarArchive(deb_tgz, ".")()
     return True
 
 
@@ -89,10 +88,10 @@ def apply_debian_patch(repo, unpack_dir, src, options, parents):
     try:
         os.chdir(unpack_dir)
 
-        if src.diff and not apply_patch(src.diff, unpack_dir):
+        if src.diff and not apply_patch(src.diff):
             raise GbpError
 
-        if src.deb_tgz and not apply_deb_tgz(src.deb_tgz, unpack_dir):
+        if src.deb_tgz and not apply_deb_tgz(src.deb_tgz):
             raise GbpError
 
         if os.path.exists('debian/rules'):
@@ -104,7 +103,6 @@ def apply_debian_patch(repo, unpack_dir, src, options, parents):
         author, email = parseaddr(dch['Maintainer'])
         if not (author and email):
             gbp.log.warn("Failed to parse maintainer")
-
         commit = repo.commit_dir(unpack_dir,
                                  "Imported Debian patch %s" % version,
                                  branch = options.debian_branch,
index d934760..418e136 100755 (executable)
@@ -19,8 +19,6 @@
 
 import glob
 import os
-import pipes
-import re
 import sys
 import tempfile
 import gbp.command_wrappers as gbpc
index f7ce667..10d85b1 100755 (executable)
@@ -414,7 +414,7 @@ on howto create it otherwise use --upstream-branch to specify it.
                             epoch = '%s:' % cp['Epoch']
                     info = { 'version': "%s%s-1" % (epoch, version) }
                     env = { 'GBP_BRANCH': options.debian_branch }
-                    cmd = gbpc.Command(options.postimport % info, extra_env=env, shell=True)()
+                    gbpc.Command(options.postimport % info, extra_env=env, shell=True)()
         except gbpc.CommandExecFailed:
             raise GbpError, "Import of %s failed" % archive
     except GbpNothingImported, err: