summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'gbp')
-rw-r--r--gbp/patch_series.py2
-rw-r--r--gbp/rpm/__init__.py4
-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
-rw-r--r--gbp/tmpfile.py8
10 files changed, 32 insertions, 30 deletions
diff --git a/gbp/patch_series.py b/gbp/patch_series.py
index 327997f5..6ca24f2c 100644
--- a/gbp/patch_series.py
+++ b/gbp/patch_series.py
@@ -72,7 +72,7 @@ class Patch(object):
header = rfc_header[:-1].lower()
self.info[header] = value.strip()
try:
- self.long_desc = "".join([ line for line in body ])
+ self.long_desc = body.read()
body.close()
except IOError as msg:
raise GbpError("Failed to read patch header of '%s': %s" %
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index d5fa1ee8..0fe2b4d8 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -804,9 +804,9 @@ def parse_srpm(srpmfile):
try:
srcrpm = SrcRpmFile(srpmfile)
except IOError, err:
- raise GbpError, "Error reading src.rpm file: %s" % err
+ raise GbpError("Error reading src.rpm file: %s" % err)
except librpm.error, err:
- raise GbpError, "RPM error while reading src.rpm: %s" % err
+ raise GbpError("RPM error while reading src.rpm: %s" % err)
return srcrpm
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' ]:
diff --git a/gbp/tmpfile.py b/gbp/tmpfile.py
index e1ad3084..9435a810 100644
--- a/gbp/tmpfile.py
+++ b/gbp/tmpfile.py
@@ -26,13 +26,13 @@ def mkdtemp(dir, **kwargs):
try:
if not os.path.exists(dir):
os.makedirs(dir)
- except OSError as (dummy_e, msg):
- raise GbpError, "Unable to create dir %s (%s)" % (dir, msg)
+ except OSError as msg:
+ raise GbpError("Unable to create dir %s (%s)" % (dir, msg))
try:
return os.path.abspath(tempfile.mkdtemp(dir=dir, **kwargs))
- except OSError as (dummy_e, msg):
- raise GbpError, "Unable to create tmpdir under %s (%s)" % (dir, msg)
+ except OSError as msg:
+ raise GbpError("Unable to create tmpdir under %s (%s)" % (dir, msg))
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: