Remove python2.4 OptionParse fix
Fixes: https://pagure.io/koji/issue/1341
This commit is contained in:
parent
58ff256604
commit
70968aba33
7 changed files with 18 additions and 43 deletions
10
cli/koji
10
cli/koji
|
|
@ -27,12 +27,12 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
import logging
|
||||
import optparse
|
||||
import os
|
||||
import re
|
||||
import six
|
||||
import sys
|
||||
import types
|
||||
|
||||
from optparse import OptionParser, SUPPRESS_HELP
|
||||
|
||||
import six.moves.configparser
|
||||
import six.moves.xmlrpc_client
|
||||
|
|
@ -41,7 +41,7 @@ import koji
|
|||
import koji.util
|
||||
import koji.plugin
|
||||
|
||||
from koji_cli.lib import _, OptionParser, get_epilog_str, greetings, \
|
||||
from koji_cli.lib import _, get_epilog_str, greetings, \
|
||||
warn, categories
|
||||
from koji_cli.commands import *
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ def get_options():
|
|||
parser.add_option("--topdir", help=_("specify topdir"))
|
||||
parser.add_option("--weburl", help=_("url of the Koji web interface"))
|
||||
parser.add_option("--topurl", help=_("url for Koji file access"))
|
||||
parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
|
||||
parser.add_option("--pkgurl", help=SUPPRESS_HELP)
|
||||
parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands"))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ def handle_help(options, session, args):
|
|||
usage += _("\n(Specify the --help global option for a list of other help options)")
|
||||
parser = OptionParser(usage=usage)
|
||||
# the --admin opt is for backwards compatibility. It is equivalent to: koji help admin
|
||||
parser.add_option("--admin", action="store_true", help=optparse.SUPPRESS_HELP)
|
||||
parser.add_option("--admin", action="store_true", help=SUPPRESS_HELP)
|
||||
|
||||
(options, args) = parser.parse_args(args)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ from collections import defaultdict, OrderedDict
|
|||
import fnmatch
|
||||
import json
|
||||
import logging
|
||||
import optparse
|
||||
import os
|
||||
import pprint
|
||||
import random
|
||||
|
|
@ -16,6 +15,7 @@ import stat
|
|||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from optparse import OptionParser, SUPPRESS_HELP
|
||||
|
||||
import dateutil.parser
|
||||
import six
|
||||
|
|
@ -36,7 +36,7 @@ except ImportError: # pragma: no cover
|
|||
|
||||
import koji
|
||||
from koji.util import md5_constructor, to_list, base64encode
|
||||
from koji_cli.lib import _, OptionParser, activate_session, parse_arches, \
|
||||
from koji_cli.lib import _, activate_session, parse_arches, \
|
||||
_unique_path, _running_in_bg, _progress_callback, watch_tasks, \
|
||||
arg_filter, linked_upload, list_task_output_all_volumes, \
|
||||
print_task_headers, print_task_recurse, download_file, watch_logs, \
|
||||
|
|
@ -225,7 +225,7 @@ def handle_add_host_to_channel(goptions, session, args):
|
|||
usage = _("usage: %prog add-host-to-channel [options] hostname channel")
|
||||
usage += _("\n(Specify the --help global option for a list of other help options)")
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("--list", action="store_true", help=optparse.SUPPRESS_HELP)
|
||||
parser.add_option("--list", action="store_true", help=SUPPRESS_HELP)
|
||||
parser.add_option("--new", action="store_true", help=_("Create channel if needed"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if not options.list and len(args) != 2:
|
||||
|
|
|
|||
|
|
@ -21,17 +21,9 @@ except ImportError: # pragma: no cover
|
|||
import koji
|
||||
from koji.util import to_list
|
||||
|
||||
# fix OptionParser for python 2.3 (optparse verion 1.4.1+)
|
||||
# code taken from optparse version 1.5a2
|
||||
# for compatibility with plugins based on older version of lib
|
||||
# Use optparse imports directly in new code.
|
||||
OptionParser = optparse.OptionParser
|
||||
if optparse.__version__ == "1.4.1+": # pragma: no cover
|
||||
def _op_error(self, msg):
|
||||
self.print_usage(sys.stderr)
|
||||
msg = "%s: error: %s\n" % (self._get_prog_name(), msg)
|
||||
if msg:
|
||||
sys.stderr.write(msg)
|
||||
sys.exit(2)
|
||||
OptionParser.error = _op_error
|
||||
|
||||
greetings = ('hello', 'hi', 'yo', "what's up", "g'day", 'back to work',
|
||||
'bonjour',
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
from __future__ import absolute_import
|
||||
import sys
|
||||
import time
|
||||
from optparse import OptionParser
|
||||
|
||||
import koji
|
||||
from koji.plugin import export_cli
|
||||
from koji_cli.lib import _, activate_session, OptionParser, watch_tasks, \
|
||||
from koji_cli.lib import _, activate_session, watch_tasks, \
|
||||
list_task_output_all_volumes, bytes_to_stdout
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
import koji
|
||||
from koji.plugin import export_cli
|
||||
from koji_cli.lib import _, activate_session, OptionParser, watch_tasks
|
||||
from koji_cli.lib import _, activate_session, watch_tasks
|
||||
|
||||
@export_cli
|
||||
def handle_save_failed_tree(options, session, args):
|
||||
|
|
|
|||
13
util/koji-gc
13
util/koji-gc
|
|
@ -28,17 +28,6 @@ import six.moves.configparser
|
|||
from six.moves import email_mime_text as MIMEText
|
||||
|
||||
|
||||
OptionParser = optparse.OptionParser
|
||||
if optparse.__version__ == "1.4.1+":
|
||||
def _op_error(self, msg):
|
||||
self.print_usage(sys.stderr)
|
||||
msg = "%s: error: %s\n" % (self._get_prog_name(), msg)
|
||||
if msg:
|
||||
sys.stderr.write(msg)
|
||||
sys.exit(2)
|
||||
OptionParser.error = _op_error
|
||||
|
||||
|
||||
def _(args):
|
||||
"""Stub function for translation"""
|
||||
return args
|
||||
|
|
@ -47,7 +36,7 @@ def get_options():
|
|||
"""process options from command line and config file"""
|
||||
|
||||
usage = _("%prog [options]")
|
||||
parser = OptionParser(usage=usage)
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option("-c", "--config-file", metavar="FILE",
|
||||
help=_("use alternate configuration file"))
|
||||
parser.add_option("--keytab", help=_("specify a Kerberos keytab to use"))
|
||||
|
|
|
|||
|
|
@ -51,16 +51,6 @@ socket.setdefaulttimeout(180) #XXX - too short?
|
|||
|
||||
logfile = None
|
||||
|
||||
OptionParser = optparse.OptionParser
|
||||
if optparse.__version__ == "1.4.1+":
|
||||
def _op_error(self, msg):
|
||||
self.print_usage(sys.stderr)
|
||||
msg = "%s: error: %s\n" % (self._get_prog_name(), msg)
|
||||
if msg:
|
||||
sys.stderr.write(msg)
|
||||
sys.exit(2)
|
||||
OptionParser.error = _op_error
|
||||
|
||||
|
||||
def _(args):
|
||||
"""Stub function for translation"""
|
||||
|
|
@ -80,7 +70,7 @@ def get_options():
|
|||
"""process options from command line and config file"""
|
||||
|
||||
usage = _("%prog [options]")
|
||||
parser = OptionParser(usage=usage)
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option("-c", "--config-file", metavar="FILE",
|
||||
help=_("use alternate configuration file"))
|
||||
parser.add_option("--keytab", help=_("specify a Kerberos keytab to use"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue