diff options
author | Papoteur <papoteur@mageialinux-online.org> | 2015-10-10 09:16:26 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageialinux-online.org> | 2015-10-10 09:16:26 +0200 |
commit | 142d404aa8cffc9f4785e5347f26036463dedcd4 (patch) | |
tree | c58f4d5c692c945eb10180baadb123d2c3762ad3 /MgaRepo/log.py | |
parent | 3e3e90e699192df60eeafb2ec7a9e087aff97195 (diff) | |
download | mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.gz mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.bz2 mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.xz mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.zip |
Apply 2to3-3.4
Diffstat (limited to 'MgaRepo/log.py')
-rw-r--r-- | MgaRepo/log.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/MgaRepo/log.py b/MgaRepo/log.py index a1ea0bf..5fded7c 100644 --- a/MgaRepo/log.py +++ b/MgaRepo/log.py @@ -6,9 +6,9 @@ from MgaRepo.util import execcmd try: from Cheetah.Template import Template except ImportError: - raise Error, "mgarepo requires the package python-cheetah" + raise Error("mgarepo requires the package python-cheetah") -from cStringIO import StringIO +from io import StringIO import sys import os @@ -83,7 +83,7 @@ def getrelease(pkgdirurl, rev=None, macros=[], exported=None): try: found = glob.glob(os.path.join(tmpdir, "*.spec")) if not found: - raise Error, "no .spec file found inside %s" % specurl + raise Error("no .spec file found inside %s" % specurl) specpath = found[0] options = rpm_macros_defs(macros) command = (("rpm -q --qf '%%{EPOCH}:%%{VERSION}-%%{RELEASE}\n' " @@ -95,14 +95,14 @@ def getrelease(pkgdirurl, rev=None, macros=[], exported=None): output = pipe.stdout.read() error = pipe.stderr.read() if pipe.returncode != 0: - raise Error, "Error in command %s: %s" % (command, error) + raise Error("Error in command %s: %s" % (command, error)) releases = output.split() try: epoch, vr = releases[0].split(":", 1) version, release = vr.split("-", 1) except ValueError: - raise Error, "Invalid command output: %s: %s" % \ - (command, output) + raise Error("Invalid command output: %s: %s" % \ + (command, output)) #XXX check if this is the right way: if epoch == "(none)": ev = version @@ -197,7 +197,7 @@ def group_releases_by_author(releases): # create _Authors and sort them by their latest revisions decorated = [] - for authorname, revs in authors.iteritems(): + for authorname, revs in authors.items(): author = _Author() author.name = revs[0].author_name author.email = revs[0].author_email @@ -374,7 +374,7 @@ def get_revision_offset(): try: revoffset = config.getint("log", "revision-offset", 0) except (ValueError, TypeError): - raise Error, ("Invalid revision-offset number in configuration " + raise Error("Invalid revision-offset number in configuration " "file(s).") return revoffset or 0 @@ -479,7 +479,7 @@ def _split_changelog(stream): def finish(entry): lines = entry[2] # strip newlines at the end - for i in xrange(len(lines)-1, -1, -1): + for i in range(len(lines)-1, -1, -1): if lines[i] != "\n": break del lines[i] @@ -492,8 +492,8 @@ def _split_changelog(stream): rawdate = " ".join(fields[:5]) try: date = time.strptime(rawdate, "* %a %b %d %Y") - except ValueError, e: - raise Error, "failed to parse spec changelog: %s" % e + except ValueError as e: + raise Error("failed to parse spec changelog: %s" % e) curlines = [line] current = (date, count, curlines) # count used to ensure stable sorting when changelog entries @@ -631,6 +631,6 @@ def specfile_svn2rpm(pkgdirurl, specfile, rev=None, size=None, if __name__ == "__main__": l = svn2rpm(sys.argv[1]) - print l + print(l) # vim:et:ts=4:sw=4 |