summaryrefslogtreecommitdiff
path: root/gbp/scripts
diff options
context:
space:
mode:
authorbiao716.wang <biao716.wang@samsung.com>2019-11-14 16:17:06 +0800
committerbiao716.wang <biao716.wang@samsung.com>2019-11-14 16:17:06 +0800
commit4696eb2a81eeb2af32cbdda8b0e612b3726ac1f7 (patch)
tree345a223e0387d52050c26f6d7bb52095953b31a7 /gbp/scripts
parentf0a26b109d267557c949c5fe1012936a3f4d85a7 (diff)
downloadgit-buildpackage-4696eb2a81eeb2af32cbdda8b0e612b3726ac1f7.tar.gz
git-buildpackage-4696eb2a81eeb2af32cbdda8b0e612b3726ac1f7.tar.bz2
git-buildpackage-4696eb2a81eeb2af32cbdda8b0e612b3726ac1f7.zip
fix pylint error for git-buildpackage
Change-Id: Ia319032dcd3f55600bb79b5c85372a7a77122174 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
Diffstat (limited to 'gbp/scripts')
-rwxr-xr-xgbp/scripts/buildpackage.py8
-rwxr-xr-xgbp/scripts/buildpackage_rpm.py16
-rwxr-xr-xgbp/scripts/import_dsc.py2
-rwxr-xr-xgbp/scripts/import_orig_rpm.py12
-rwxr-xr-xgbp/scripts/import_srpm.py2
-rwxr-xr-xgbp/scripts/pq.py4
-rw-r--r--gbp/scripts/supercommand.py4
7 files changed, 25 insertions, 23 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index cef0584f..43dc261e 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -166,8 +166,8 @@ def move_old_export(target):
"""move a build tree away if it exists"""
try:
os.mkdir(target)
- except OSError as (e, msg):
- if e == errno.EEXIST:
+ except OSError as msg:
+ if msg.errno == errno.EEXIST:
os.rename(target, "%s.obsolete.%s" % (target, time.time()))
@@ -213,8 +213,8 @@ def prepare_output_dir(dir):
try:
os.mkdir(output_dir)
- except OSError as (e, msg):
- if e != errno.EEXIST:
+ except OSError as msg:
+ if msg.errno != errno.EEXIST:
raise GbpError("Cannot create output dir %s" % output_dir)
return output_dir
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index 56db5e13..7708dfce 100755
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -110,9 +110,9 @@ def makedir(dir):
"""Create directory"""
try:
os.mkdir(dir)
- except OSError, (e, msg):
- if e != errno.EEXIST:
- raise GbpError, "Cannot create dir %s" % dir
+ except OSError as msg:
+ if msg.errno != errno.EEXIST:
+ raise GbpError("Cannot create dir %s" % dir)
return dir
@@ -335,8 +335,8 @@ def update_tag_str_fields(fields, tag_format_str, repo, commit_info):
committimenum=fields['committime'] + ".(?P<commitnum>[0-9]+)")
try:
tag_re = re.compile("^%s$" % (tag_format_str % re_fields))
- except KeyError, err:
- raise GbpError, "Unknown field '%s' in packaging-tag format string" % err
+ except KeyError as err:
+ raise GbpError("Unknown field '%s' in packaging-tag format string" % err)
fields['nowtimenum'] = fields['nowtime'] + ".1"
fields['authortimenum'] = fields['authortime'] + ".1"
@@ -559,12 +559,12 @@ def main(argv):
if not ret:
gbp.log.err("You have uncommitted changes in your source tree:")
gbp.log.err(out)
- raise GbpError, "Use --git-ignore-new or --git-ignore-untracked to ignore."
+ raise GbpError("Use --git-ignore-new or --git-ignore-untracked to ignore.")
if not options.ignore_new and not options.ignore_branch:
if branch != options.packaging_branch:
gbp.log.err("You are not on branch '%s' but on '%s'" % (options.packaging_branch, branch))
- raise GbpError, "Use --git-ignore-branch to ignore or --git-packaging-branch to set the branch name."
+ raise GbpError("Use --git-ignore-branch to ignore or --git-packaging-branch to set the branch name.")
# Dump from git to a temporary directory:
dump_dir = tempfile.mkdtemp(dir=options.tmp_dir,
@@ -605,7 +605,7 @@ def main(argv):
try:
shutil.copy2(src, dst)
except IOError as err:
- raise GbpError, "Error exporting files: %s" % err
+ raise GbpError("Error exporting files: %s" % err)
spec.specdir = os.path.abspath(spec_dir)
if options.orig_prefix != 'auto':
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index b19d95fc..41eae8c7 100755
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -144,7 +144,7 @@ def apply_debian_patch(repo, unpack_dir, src, options, tag):
raise GbpError
if os.path.exists('debian/rules'):
- os.chmod('debian/rules', 0755)
+ os.chmod('debian/rules', 0o755)
os.chdir(repo.path)
parents = check_parents(repo,
diff --git a/gbp/scripts/import_orig_rpm.py b/gbp/scripts/import_orig_rpm.py
index b1247f1e..4b318a2c 100755
--- a/gbp/scripts/import_orig_rpm.py
+++ b/gbp/scripts/import_orig_rpm.py
@@ -76,7 +76,7 @@ def detect_name_and_version(repo, source, spec, options):
if guessed_package:
sourcepackage = guessed_package
else:
- raise GbpError, "Couldn't determine upstream package name. Use --interactive."
+ raise GbpError("Couldn't determine upstream package name. Use --interactive.")
# Try to find the version.
if options.version:
@@ -90,7 +90,7 @@ def detect_name_and_version(repo, source, spec, options):
if guessed_version:
version = guessed_version
else:
- raise GbpError, "Couldn't determine upstream version. Use '-u<version>' or --interactive."
+ raise GbpError ("Couldn't determine upstream version. Use '-u<version>' or --interactive.")
return (sourcepackage, version)
@@ -228,7 +228,7 @@ def main(argv):
try:
repo = RpmGitRepository('.')
except GitRepositoryError:
- raise GbpError, "%s is not a git repository" % (os.path.abspath('.'))
+ raise GbpError ("%s is not a git repository" % (os.path.abspath('.')))
spec = find_spec(repo, options)
source = find_source(spec, options, args)
@@ -252,7 +252,7 @@ def main(argv):
(clean, out) = repo.is_clean()
if not clean and not is_empty:
gbp.log.err("Repository has uncommitted changes, commit these first: ")
- raise GbpError, out
+ raise GbpError(out)
if repo.bare:
set_bare_repo_options(options)
@@ -313,7 +313,7 @@ def main(argv):
try:
repo.merge(tag)
except GitRepositoryError:
- raise GbpError, """Merge failed, please resolve."""
+ raise GbpError("""Merge failed, please resolve.""")
else:
repo.create_branch(options.packaging_branch, rev=options.upstream_branch)
if repo.get_branch() == options.packaging_branch:
@@ -330,7 +330,7 @@ def main(argv):
current_branch == repo.pristine_tar_branch):
repo.force_head(current_branch, hard=True)
except (GitRepositoryError, gbpc.CommandExecFailed):
- raise GbpError, "Import of %s failed" % source.path
+ raise GbpError("Import of %s failed" % source.path)
except GbpError, err:
if len(err.__str__()):
gbp.log.err(err)
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py
index 85f1225f..b573f2bc 100755
--- a/gbp/scripts/import_srpm.py
+++ b/gbp/scripts/import_srpm.py
@@ -306,7 +306,7 @@ def main(argv):
if not clean and not is_empty:
gbp.log.err("Repository has uncommitted changes, commit "
"these first: ")
- raise GbpError, out
+ raise GbpError(out)
except GitRepositoryError:
gbp.log.info("No git repository found, creating one.")
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 7053d0af..f15753ce 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -167,8 +167,8 @@ def export_patches(repo, branch, options):
pq_branch = pq_branch_name(branch, options)
try:
shutil.rmtree(PATCH_DIR)
- except OSError as (e, msg):
- if e != errno.ENOENT:
+ except OSError as msg:
+ if msg.errno != errno.ENOENT:
raise GbpError("Failed to remove patch dir: %s" % msg)
else:
gbp.log.debug("%s does not exist." % PATCH_DIR)
diff --git a/gbp/scripts/supercommand.py b/gbp/scripts/supercommand.py
index 83c8446b..493554f2 100644
--- a/gbp/scripts/supercommand.py
+++ b/gbp/scripts/supercommand.py
@@ -109,7 +109,9 @@ def supercommand(argv=None):
usage()
return 1
- prg, cmd = argv[0:2]
+ #prg, cmd = argv[0:2] prg is not used
+ cmd = argv[1]
+
args = argv[1:]
if cmd in ['--help', '-h', 'help' ]: