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

@ -7,7 +7,6 @@ from optparse import OptionParser
import koji
from koji.plugin import export_cli
from koji_cli.lib import (
_,
activate_session,
bytes_to_stdout,
list_task_output_all_volumes,
@ -18,38 +17,38 @@ from koji_cli.lib import (
@export_cli
def handle_runroot(options, session, args):
"[admin] Run a command in a buildroot"
usage = _("usage: %prog runroot [options] <tag> <arch> <command>")
usage += _("\n(Specify the --help global option for a list of other help options)")
usage = "usage: %prog runroot [options] <tag> <arch> <command>"
usage += "\n(Specify the --help global option for a list of other help options)"
parser = OptionParser(usage=usage)
parser.disable_interspersed_args()
parser.add_option("-p", "--package", action="append", default=[],
help=_("make sure this package is in the chroot"))
help="make sure this package is in the chroot")
parser.add_option("-m", "--mount", action="append", default=[],
help=_("mount this directory read-write in the chroot"))
help="mount this directory read-write in the chroot")
parser.add_option("--skip-setarch", action="store_true", default=False,
help=_("bypass normal setarch in the chroot"))
parser.add_option("-w", "--weight", type='int', help=_("set task weight"))
parser.add_option("--channel-override", help=_("use a non-standard channel"))
help="bypass normal setarch in the chroot")
parser.add_option("-w", "--weight", type='int', help="set task weight")
parser.add_option("--channel-override", help="use a non-standard channel")
parser.add_option("--task-id", action="store_true", default=False,
help=_("Print the ID of the runroot task"))
help="Print the ID of the runroot task")
parser.add_option("--use-shell", action="store_true", default=False,
help=_("Run command through a shell, otherwise uses exec"))
help="Run command through a shell, otherwise uses exec")
parser.add_option("--new-chroot", action="store_true", default=None,
help=_("Run command with the --new-chroot (systemd-nspawn) option to mock"))
help="Run command with the --new-chroot (systemd-nspawn) option to mock")
parser.add_option("--old-chroot", action="store_false", default=None, dest='new_chroot',
help=_("Run command with the --old-chroot (systemd-nspawn) option to mock"))
parser.add_option("--repo-id", type="int", help=_("ID of the repo to use"))
help="Run command with the --old-chroot (systemd-nspawn) option to mock")
parser.add_option("--repo-id", type="int", help="ID of the repo to use")
parser.add_option("--nowait", action="store_false", dest="wait",
default=True, help=_("Do not wait on task"))
default=True, help="Do not wait on task")
parser.add_option("--watch", action="store_true",
help=_("Watch task instead of printing runroot.log"))
help="Watch task instead of printing runroot.log")
parser.add_option("--quiet", action="store_true", default=options.quiet,
help=_("Do not print the task information"))
help="Do not print the task information")
(opts, args) = parser.parse_args(args)
if len(args) < 3:
parser.error(_("Incorrect number of arguments"))
parser.error("Incorrect number of arguments")
assert False # pragma: no cover
activate_session(session, options)

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

View file

@ -10,32 +10,22 @@ from argparse import ArgumentParser
import koji
from koji.plugin import export_cli
from koji_cli.commands import anon_handle_wait_repo
from koji_cli.lib import _, activate_session, arg_filter
from koji_cli.lib import activate_session, arg_filter
@export_cli
def handle_add_sidetag(options, session, args):
"Create sidetag"
usage = _("%(prog)s add-sidetag [options] <basetag>")
usage += _("\n(Specify the --help global option for a list of other help options)")
usage = "%(prog)s add-sidetag [options] <basetag>"
usage += "\n(Specify the --help global option for a list of other help options)"
parser = ArgumentParser(usage=usage)
parser.add_argument("basetag", help="name of basetag")
parser.add_argument(
"-q",
"--quiet",
action="store_true",
help=_("Do not print tag name"),
default=options.quiet,
)
parser.add_argument(
"-w", "--wait", action="store_true", help=_("Wait until repo is ready.")
)
parser.add_argument(
"--debuginfo", action="store_true", help=_("Buildroot repo will contain debuginfos")
)
parser.add_argument(
"--suffix", action="store", help=_("Suffix from hub-supported ones")
)
parser.add_argument("-q", "--quiet", action="store_true", help="Do not print tag name",
default=options.quiet)
parser.add_argument("-w", "--wait", action="store_true", help="Wait until repo is ready.")
parser.add_argument("--debuginfo", action="store_true",
help="Buildroot repo will contain debuginfos")
parser.add_argument("--suffix", action="store", help="Suffix from hub-supported ones")
opts = parser.parse_args(args)
@ -47,10 +37,10 @@ def handle_add_sidetag(options, session, args):
try:
tag = session.createSideTag(opts.basetag, **kwargs)
except koji.ActionNotAllowed:
parser.error(_("Policy violation"))
parser.error("Policy violation")
except koji.ParameterError as ex:
if 'suffix' in str(ex):
parser.error(_("Hub is older and doesn't support --suffix, please run it without it"))
parser.error("Hub is older and doesn't support --suffix, please run it without it")
else:
raise
@ -67,8 +57,8 @@ def handle_add_sidetag(options, session, args):
@export_cli
def handle_remove_sidetag(options, session, args):
"Remove sidetag"
usage = _("%(prog)s remove-sidetag [options] <sidetag> ...")
usage += _("\n(Specify the --help global option for a list of other help options)")
usage = "%(prog)s remove-sidetag [options] <sidetag> ..."
usage += "\n(Specify the --help global option for a list of other help options)"
parser = ArgumentParser(usage=usage)
parser.add_argument("sidetags", help="name of sidetag", nargs="+")
opts = parser.parse_args(args)
@ -84,17 +74,17 @@ def handle_remove_sidetag(options, session, args):
@export_cli
def handle_list_sidetags(options, session, args):
"List sidetags"
usage = _("%(prog)s list-sidetags [options]")
usage += _("\n(Specify the --help global option for a list of other help options)")
usage = "%(prog)s list-sidetags [options]"
usage += "\n(Specify the --help global option for a list of other help options)"
parser = ArgumentParser(usage=usage)
parser.add_argument("--basetag", action="store", help=_("Filter on basetag"))
parser.add_argument("--user", action="store", help=_("Filter on user"))
parser.add_argument("--mine", action="store_true", help=_("Filter on user"))
parser.add_argument("--basetag", action="store", help="Filter on basetag")
parser.add_argument("--user", action="store", help="Filter on user")
parser.add_argument("--mine", action="store_true", help="Filter on user")
opts = parser.parse_args(args)
if opts.mine and opts.user:
parser.error(_("Specify only one from --user --mine"))
parser.error("Specify only one from --user --mine")
if opts.mine:
activate_session(session, options)
@ -109,17 +99,17 @@ def handle_list_sidetags(options, session, args):
@export_cli
def handle_edit_sidetag(options, session, args):
"Edit sidetag"
usage = _("%(prog)s edit-sidetag [options]")
usage += _("\n(Specify the --help global option for a list of other help options)")
usage = "%(prog)s edit-sidetag [options]"
usage += "\n(Specify the --help global option for a list of other help options)"
parser = ArgumentParser(usage=usage)
parser.add_argument("sidetag", help="name of sidetag")
parser.add_argument("--debuginfo", action="store_true", default=None,
help=_("Generate debuginfo repository"))
help="Generate debuginfo repository")
parser.add_argument("--no-debuginfo", action="store_false", dest="debuginfo")
parser.add_argument("--rpm-macro", action="append", default=[], metavar="key=value",
dest="rpm_macros", help=_("Set tag-specific rpm macros"))
dest="rpm_macros", help="Set tag-specific rpm macros")
parser.add_argument("--remove-rpm-macro", action="append", default=[], metavar="key",
dest="remove_rpm_macros", help=_("Remove rpm macros"))
dest="remove_rpm_macros", help="Remove rpm macros")
opts = parser.parse_args(args)