Commit 9cf1ec23 authored by David 'Digit' Turner's avatar David 'Digit' Turner Committed by Commit Bot

tools/grit: Cleanup the cmd-line options parser.

This patch removes a few obsolete options from the grit tool,
that were not even documented through -h:

  -d and -c <client>, which were allegedly used to handle
   communication with Perforce in the past, and no longer
   needed (or used by the code).

  --psyco, since this project is now dead and unmaintained
   and the flag was never used by the Chromium build.

  '-g <param>' and '-q' are no longer accepted and ignored.

'grit unit' was invoked to run the unit-test suite
and was succesful on Linux.

BUG=None
R=thakis@chromium.org,joi@chromium.org

Change-Id: I97de9a7d3b32bdbe0a050df7719635ddec0cb663
Reviewed-on: https://chromium-review.googlesource.com/631938
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516362}
parent 17d6a417
......@@ -111,12 +111,6 @@ def PrintUsage():
if not _HIDDEN in info.keys():
tool_list += ' %-12s %s\n' % (tool, info[_FACTORY]().ShortDescription())
# TODO(joi) Put these back into the usage when appropriate:
#
# -d Work disconnected. This causes GRIT not to attempt connections with
# e.g. Perforce.
#
# -c Use the specified Perforce CLIENT when talking to Perforce.
print """GRIT - the Google Resource and Internationalization Tool
Usage: grit [GLOBALOPTIONS] TOOL [args to tool]
......@@ -152,23 +146,18 @@ class Options(object):
"""Option storage and parsing."""
def __init__(self):
self.disconnected = False
self.client = ''
self.hash = None
self.input = None
self.verbose = False
self.extra_verbose = False
self.output_stream = sys.stdout
self.profile_dest = None
self.psyco = False
def ReadOptions(self, args):
"""Reads options from the start of args and returns the remainder."""
(opts, args) = getopt.getopt(args, 'g:qdvxc:i:p:h:', ('psyco',))
(opts, args) = getopt.getopt(args, 'vxi:p:h:')
for (key, val) in opts:
if key == '-d': self.disconnected = True
elif key == '-c': self.client = val
elif key == '-h': self.hash = val
if key == '-h': self.hash = val
elif key == '-i': self.input = val
elif key == '-v':
self.verbose = True
......@@ -179,7 +168,6 @@ class Options(object):
self.extra_verbose = True
util.extra_verbose = True
elif key == '-p': self.profile_dest = val
elif key == '--psyco': self.psyco = True
if not self.input:
if 'GRIT_INPUT' in os.environ:
......@@ -190,8 +178,8 @@ class Options(object):
return args
def __repr__(self):
return '(disconnected: %d, verbose: %d, client: %s, input: %s)' % (
self.disconnected, self.verbose, self.client, self.input)
return '(verbose: %d, input: %s)' % (
self.verbose, self.input)
def _GetToolInfo(tool):
......@@ -249,13 +237,6 @@ def Main(args):
' from the current directory.' % options.input)
return 2
if options.psyco:
# Psyco is a specializing JIT for Python. Early tests indicate that it
# could speed up GRIT (at the expense of more memory) for large GRIT
# compilations. See http://psyco.sourceforge.net/
import psyco
psyco.profile()
if options.hash:
grit.extern.FP.UseUnsignedFingerPrintFromModule(options.hash)
......
......@@ -28,9 +28,8 @@ class OptionArgsUnittest(unittest.TestCase):
def testSimple(self):
grit.grit_runner.Main(['-i',
util.PathFromRoot('grit/testdata/simple-input.xml'),
'-d', 'test', 'bla', 'voff', 'ga'])
'test', 'bla', 'voff', 'ga'])
output = self.buf.getvalue()
self.failUnless(output.count('disconnected'))
self.failUnless(output.count("'test'") == 0) # tool name doesn't occur
self.failUnless(output.count('bla'))
self.failUnless(output.count('simple-input.xml'))
......
......@@ -14,8 +14,7 @@ from grit.tool import interface
class UnitTestTool(interface.Tool):
'''By using this tool (e.g. 'grit unit') you run all the unit tests for GRIT.
This happens in the environment that is set up by the basic GRIT runner, i.e.
whether to run disconnected has been specified, etc.'''
This happens in the environment that is set up by the basic GRIT runner.'''
def ShortDescription(self):
return 'Use this tool to run all the unit tests for GRIT.'
......@@ -23,4 +22,3 @@ whether to run disconnected has been specified, etc.'''
def Run(self, opts, args):
return unittest.TextTestRunner(verbosity=2).run(
grit.test_suite_all.TestSuiteAll())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment