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/commands | |
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/commands')
-rw-r--r-- | MgaRepo/commands/authoremail.py | 6 | ||||
-rw-r--r-- | MgaRepo/commands/changed.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/co.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/create.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/del.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/editlog.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/getspec.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/getsrpm.py | 4 | ||||
-rw-r--r-- | MgaRepo/commands/maintdb.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/markrelease.py | 14 | ||||
-rw-r--r-- | MgaRepo/commands/patchspec.py | 2 | ||||
-rw-r--r-- | MgaRepo/commands/rpmlog.py | 4 | ||||
-rw-r--r-- | MgaRepo/commands/submit.py | 44 |
13 files changed, 44 insertions, 44 deletions
diff --git a/MgaRepo/commands/authoremail.py b/MgaRepo/commands/authoremail.py index edfe332..fcb8a86 100644 --- a/MgaRepo/commands/authoremail.py +++ b/MgaRepo/commands/authoremail.py @@ -21,15 +21,15 @@ def parse_options(): parser = OptionParser(help=HELP) opts, args = parser.parse_args() if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.author = args[0] return opts def print_author_email(author): email = config.get("users", author) if not email: - raise Error, "author not found" - print email + raise Error("author not found") + print(email) def main(): do_command(parse_options, print_author_email) diff --git a/MgaRepo/commands/changed.py b/MgaRepo/commands/changed.py index a17226b..4ac16bc 100644 --- a/MgaRepo/commands/changed.py +++ b/MgaRepo/commands/changed.py @@ -30,7 +30,7 @@ def parse_options(): callback=disable_mirror) opts, args = parser.parse_args() if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(args[0]) opts.verbose = 1 # Unconfigurable return opts diff --git a/MgaRepo/commands/co.py b/MgaRepo/commands/co.py index 0a111e2..24ce257 100644 --- a/MgaRepo/commands/co.py +++ b/MgaRepo/commands/co.py @@ -42,7 +42,7 @@ def parse_options(): callback=disable_mirror) opts, args = parser.parse_args() if len(args) not in (1, 2): - raise Error, "invalid arguments" + raise Error("invalid arguments") # here we don't use package_url in order to notify the user we are # using the mirror opts.pkgdirurl = args[0] diff --git a/MgaRepo/commands/create.py b/MgaRepo/commands/create.py index da8f16c..e9a89e8 100644 --- a/MgaRepo/commands/create.py +++ b/MgaRepo/commands/create.py @@ -23,7 +23,7 @@ def parse_options(): parser = OptionParser(help=HELP) opts, args = parser.parse_args() if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(args[0], mirrored=False) opts.verbose = 1 # Unconfigurable return opts diff --git a/MgaRepo/commands/del.py b/MgaRepo/commands/del.py index f61a1d5..050c7bc 100644 --- a/MgaRepo/commands/del.py +++ b/MgaRepo/commands/del.py @@ -18,7 +18,7 @@ def parse_options(): if len(args): opts.paths = args else: - raise Error, "you need to provide a path" + raise Error("you need to provide a path") return opts def main(): diff --git a/MgaRepo/commands/editlog.py b/MgaRepo/commands/editlog.py index c58c16b..163651d 100644 --- a/MgaRepo/commands/editlog.py +++ b/MgaRepo/commands/editlog.py @@ -24,7 +24,7 @@ def parse_options(): elif len(args) == 1: pkgdirurl, revision = "", args[0] else: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(pkgdirurl, mirrored=False) opts.revision = re.compile(r".*?(\d+).*").sub(r"\1", revision) return opts diff --git a/MgaRepo/commands/getspec.py b/MgaRepo/commands/getspec.py index 08407bc..e1ba4c4 100644 --- a/MgaRepo/commands/getspec.py +++ b/MgaRepo/commands/getspec.py @@ -28,7 +28,7 @@ def parse_options(): callback=disable_mirror) opts, args = parser.parse_args() if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(args[0]) return opts diff --git a/MgaRepo/commands/getsrpm.py b/MgaRepo/commands/getsrpm.py index 9c96309..82bd626 100644 --- a/MgaRepo/commands/getsrpm.py +++ b/MgaRepo/commands/getsrpm.py @@ -49,7 +49,7 @@ def mode_callback(option, opt, val, parser, mode): try: opts.version, opts.release = val.split("-", 1) except ValueError: - raise Error, "wrong version, use something like 2.2-1mdk" + raise Error("wrong version, use something like 2.2-1mdk") elif mode == "revision": opts.revision = val @@ -83,7 +83,7 @@ def parse_options(): opts, args = parser.parse_args() del opts.__ignore if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(args[0]) opts.verbose = 1 return opts diff --git a/MgaRepo/commands/maintdb.py b/MgaRepo/commands/maintdb.py index 08bf723..9a97be8 100644 --- a/MgaRepo/commands/maintdb.py +++ b/MgaRepo/commands/maintdb.py @@ -27,7 +27,7 @@ def parse_options(): if len(args): opts.maintdb_args = args else: - raise Error, "you need to provide arguments, see them with --help" + raise Error("you need to provide arguments, see them with --help") return opts def maintdb(maintdb_args): diff --git a/MgaRepo/commands/markrelease.py b/MgaRepo/commands/markrelease.py index 857d38d..534d87f 100644 --- a/MgaRepo/commands/markrelease.py +++ b/MgaRepo/commands/markrelease.py @@ -45,7 +45,7 @@ def version_callback(option, opt, val, parser): try: opts.version, opts.release = val.split("-", 1) except ValueError: - raise Error, "wrong version, use something like 1:2.2-1mdk" + raise Error("wrong version, use something like 1:2.2-1mdk") def parse_options(): parser = OptionParser(help=HELP) @@ -59,7 +59,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(args[0], mirrored=False) @@ -69,12 +69,12 @@ def parse_options(): if filename: if not os.path.isfile(filename): - raise Error, "file not found: "+filename + raise Error("file not found: "+filename) if not opts.revision: basename = os.path.basename(filename) end = basename.find(":") if basename[0] != "@" or end == -1: - raise Error, "couldn't guess revision from filename" + raise Error("couldn't guess revision from filename") opts.revision = basename[1:end] srpm = None if not opts.version: @@ -89,11 +89,11 @@ def parse_options(): srpm = SRPM(filename) opts.pkgdirurl = "/".join([opts.pkgdirurl, srpm.name]) elif appendname: - raise Error, "option -n requires option -f" + raise Error("option -n requires option -f") elif not opts.revision: - raise Error, "no revision provided" + raise Error("no revision provided") elif not opts.version: - raise Error, "no version provided" + raise Error("no version provided") #get_auth() return opts diff --git a/MgaRepo/commands/patchspec.py b/MgaRepo/commands/patchspec.py index 9a5811c..dfe54dc 100644 --- a/MgaRepo/commands/patchspec.py +++ b/MgaRepo/commands/patchspec.py @@ -27,7 +27,7 @@ def parse_options(): parser.add_option("-l", dest="log", default="") opts, args = parser.parse_args() if len(args) != 2: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = package_url(args[0], mirrored=False) opts.patchfile = args[1] return opts diff --git a/MgaRepo/commands/rpmlog.py b/MgaRepo/commands/rpmlog.py index 722cfe9..88dfc4b 100644 --- a/MgaRepo/commands/rpmlog.py +++ b/MgaRepo/commands/rpmlog.py @@ -7,7 +7,7 @@ from MgaRepo import Error, layout, disable_mirror from MgaRepo.command import * from MgaRepo.svn import SVN from MgaRepo.log import get_changelog, split_spec_changelog -from cStringIO import StringIO +from io import StringIO import getopt import os import sys @@ -47,7 +47,7 @@ def parse_options(): callback=disable_mirror) opts, args = parser.parse_args() if len(args) != 1: - raise Error, "invalid arguments" + raise Error("invalid arguments") opts.pkgdirurl = layout.package_url(args[0]) return opts diff --git a/MgaRepo/commands/submit.py b/MgaRepo/commands/submit.py index d9dfdbc..9f05dca 100644 --- a/MgaRepo/commands/submit.py +++ b/MgaRepo/commands/submit.py @@ -4,14 +4,14 @@ from MgaRepo.svn import SVN from MgaRepo.command import * from MgaRepo.rpmutil import get_spec, get_submit_info from MgaRepo.util import get_auth, execcmd, get_helper -import urllib +import urllib.request, urllib.parse, urllib.error import getopt import sys import re import subprocess import uuid -import xmlrpclib +import xmlrpc.client HELP = """\ Usage: mgarepo submit [OPTIONS] [URL[@REVISION] ...] @@ -77,14 +77,14 @@ def parse_options(): if not args: name, url, rev = get_submit_info(".") args = ["%s@%s" % (url, str(rev))] - print "Submitting %s at revision %s" % (name, rev) - print "URL: %s" % url + print("Submitting %s at revision %s" % (name, rev)) + print("URL: %s" % url) if opts.revision is not None: # backwards compatibility with the old -r usage if len(args) == 1: args[0] = args[0] + "@" + opts.revision else: - raise Error, "can't use -r REV with more than one package name" + raise Error("can't use -r REV with more than one package name") del opts.revision if len(args) == 2: # prevent from using the old <name> <rev> syntax @@ -94,14 +94,14 @@ def parse_options(): # ok, it is a package name, let it pass pass else: - raise Error, "the format <name> <revision> is deprecated, "\ - "use <name>@<revision> instead" + raise Error("the format <name> <revision> is deprecated, "\ + "use <name>@<revision> instead") # expand group aliases expanded = [] for nameurl in args: expanded.extend(expand_group(nameurl)) if expanded != args: - print "Submitting: %s" % " ".join(expanded) + print("Submitting: %s" % " ".join(expanded)) args = expanded # generate URLs for package names: opts.urls = [mirror.strip_username( @@ -111,28 +111,28 @@ def parse_options(): newurls = [] for url in opts.urls: if not "@" in url: - print "Fetching revision..." + print("Fetching revision...") courl = layout.checkout_url(url) log = SVN().log(courl, limit=1) if not log: - raise Error, "can't find a revision for %s" % courl + raise Error("can't find a revision for %s" % courl) ci = log[0] - print "URL:", url - print "Commit:", - print "%d | %s" % (ci.revision, ci.author), + print("URL:", url) + print("Commit:", end=' ') + print("%d | %s" % (ci.revision, ci.author), end=' ') if ci.lines: line = " ".join(ci.lines).strip() if len(line) > 57: line = line[:57] + "..." - print "| %s" % line, - print + print("| %s" % line, end=' ') + print() url = url + "@" + str(ci.revision) newurls.append(url) opts.urls[:] = newurls # choose a target if not specified: if opts.target is None and opts.distro is None: target = layout.distro_branch(opts.urls[0]) or DEFAULT_TARGET - print "Implicit target: %s" % target + print("Implicit target: %s" % target) opts.target = target del opts.distro return opts @@ -157,7 +157,7 @@ def expand_group(group): def list_targets(option, opt, val, parser): host = config.get("submit", "host") if host is None: - raise Error, "no submit host defined in mgarepo.conf" + raise Error("no submit host defined in mgarepo.conf") createsrpm = get_helper("create-srpm") #TODO make it configurable command = "ssh %s %s --list" % (host, createsrpm) @@ -169,10 +169,10 @@ def submit(urls, target, define=[], submithost=None, atonce=False, sid=None): submithost = config.get("submit", "host") if submithost is None: # extract the submit host from the svn host - type, rest = urllib.splittype(pkgdirurl) - host, path = urllib.splithost(rest) - user, host = urllib.splituser(host) - submithost, port = urllib.splitport(host) + type, rest = urllib.parse.splittype(pkgdirurl) + host, path = urllib.parse.splithost(rest) + user, host = urllib.parse.splituser(host) + submithost, port = urllib.parse.splitport(host) del type, user, port, path, rest # runs a create-srpm in the server through ssh, which will make a # copy of the rpm in the export directory @@ -200,7 +200,7 @@ def submit(urls, target, define=[], submithost=None, atonce=False, sid=None): command = subprocess.list2cmdline(cmdargs) status, output = execcmd(command) if status == 0: - print "Package submitted!" + print("Package submitted!") else: sys.stderr.write(output) sys.exit(status) |