summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-11-12 16:25:57 -0500
committerMark McLoughlin <markmc@redhat.com>2012-11-15 15:01:11 -0500
commit768a147ac5e993df3eda3558542a3fe81b8a3d11 (patch)
tree27b136dd15764e71f215a05f9e650fd80229ce83 /openstack
parentac180b95d1867c4b4daf9729e97ce93f3201d178 (diff)
downloadoslo-768a147ac5e993df3eda3558542a3fe81b8a3d11.tar.gz
oslo-768a147ac5e993df3eda3558542a3fe81b8a3d11.tar.xz
oslo-768a147ac5e993df3eda3558542a3fe81b8a3d11.zip
Use stock argparse --usage behaviour
optparse would substitute the program name for %prog, but argparse requires %(prog)s. Also, optparse would print 'Usage:' whereas argparse prints 'usage:'. Neither optparse behaviour that's worth retaining, let's just use the default argparse behaviour. Change-Id: Ied2acb37c366f1a45aed72b6b76f11e2de23828e
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/cfg.py22
1 files changed, 0 insertions, 22 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py
index d234608..f4757bc 100644
--- a/openstack/common/cfg.py
+++ b/openstack/common/cfg.py
@@ -930,10 +930,6 @@ class ConfigCliParser(argparse.ArgumentParser):
def __init__(self, prog=None, usage=None, version=None, *args, **kwargs):
super(ConfigCliParser, self).__init__(prog=prog, usage=usage,
*args, **kwargs)
- # to eliminate error:
- # ValueError: unsupported format character 'p' (0x70) at index 1
- if usage is not None:
- self.usage = usage.replace("%prog", self.prog)
self.add_argument('--version', action='version', version=version)
self._optionals.title = 'Options'
@@ -961,24 +957,6 @@ class ConfigCliParser(argparse.ArgumentParser):
return opts, args
- def print_usage(self, file=None):
- '''
- overriding original print_usage method, only for
- compatibility with optparse and happiness of unittest
- '''
- print >>file, "Usage: " + self.usage
-
- def print_help(self, file=None):
- '''
- overriding original print_usage method, only for
- compatibility with optparse and happiness of unittest
- unittest: HelpTestCase:test_print_help
- '''
- msg = self.format_help()
- if 0 == msg.find("usage:"):
- msg = msg.replace("usage:", "Usage:")
- print >>file, msg
-
class ConfigOpts(collections.Mapping):