Remove translation stub functions

Fixes: https://pagure.io/koji/issue/3072
This commit is contained in:
Jana Cupova 2021-10-18 21:52:15 +02:00
parent 9e542f509a
commit 32b5377392
11 changed files with 1403 additions and 1556 deletions

View file

@ -4,38 +4,35 @@ from optparse import OptionParser
import koji
from koji.plugin import export_cli
from koji_cli.lib import _, activate_session, watch_tasks
from koji_cli.lib import activate_session, watch_tasks
@export_cli
def handle_save_failed_tree(options, session, args):
"Create tarball with whole buildtree"
usage = _("usage: %prog save-failed-tree [options] ID")
usage += _("\n(Specify the --help global option for a list of other help options)")
usage = "usage: %prog save-failed-tree [options] ID"
usage += "\n(Specify the --help global option for a list of other help options)"
parser = OptionParser(usage=usage)
parser.add_option("-f", "--full", action="store_true", default=False,
help=_("Download whole tree, if not specified, "
"only builddir will be downloaded"))
parser.add_option("-t", "--task", action="store_const", dest="mode",
const="task", default="task",
help=_("Treat ID as a task ID (the default)"))
help="Download whole tree, if not specified, "
"only builddir will be downloaded")
parser.add_option("-t", "--task", action="store_const", dest="mode", const="task",
default="task", help="Treat ID as a task ID (the default)")
parser.add_option("-r", "--buildroot", action="store_const", dest="mode",
const="buildroot",
help=_("Treat ID as a buildroot ID"))
const="buildroot", help="Treat ID as a buildroot ID")
parser.add_option("--quiet", action="store_true", default=options.quiet,
help=_("Do not print the task information"))
parser.add_option("--nowait", action="store_true",
help=_("Don't wait on build"))
help="Do not print the task information")
parser.add_option("--nowait", action="store_true", help="Don't wait on build")
(opts, args) = parser.parse_args(args)
if len(args) != 1:
parser.error(_("List exactly one task or buildroot ID"))
parser.error("List exactly one task or buildroot ID")
try:
id_val = int(args[0])
except ValueError:
parser.error(_("ID must be an integer"))
parser.error("ID must be an integer")
activate_session(session, options)
@ -44,27 +41,25 @@ def handle_save_failed_tree(options, session, args):
else:
brs = [b['id'] for b in session.listBuildroots(taskID=id_val)]
if not brs:
print(_("No buildroots for task %s") % id_val)
print("No buildroots for task %s" % id_val)
return 1
br_id = max(brs)
if len(brs) > 1:
print(_("Multiple buildroots for task. Choosing last one (%s)") % br_id)
print("Multiple buildroots for task. Choosing last one (%s)" % br_id)
try:
task_id = session.saveFailedTree(br_id, opts.full)
except koji.GenericError as e:
m = str(e)
if 'Invalid method' in m:
print(_("* The save_failed_tree plugin appears to not be "
"installed on the koji hub. Please contact the "
"administrator."))
print("* The save_failed_tree plugin appears to not be installed on the koji hub. "
"Please contact the administrator.")
return 1
raise
if not opts.quiet:
print(_("Created task %s for buildroot %s") % (task_id, br_id))
print("Task info: %s/taskinfo?taskID=%s"
% (options.weburl, task_id))
print("Created task %s for buildroot %s" % (task_id, br_id))
print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
if opts.nowait:
return