Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: gclient.py

Issue 2776006: Options cleanup, enforce nohooks and deps_os are always defined. (Closed)
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 748c6dc10213ffec625684a1451f37be11cdb0d1..586c655f912aef538963c18e246e0a7a6a2f7375 100644
--- a/gclient.py
+++ b/gclient.py
@@ -1090,27 +1090,33 @@ def Main(argv):
' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip())
for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')]))
parser = optparse.OptionParser(version='%prog ' + __version__)
- parser.add_option("-v", "--verbose", action="count", default=0,
- help="Produces additional output for diagnostics. Can be "
- "used up to three times for more logging info.")
- parser.add_option("--gclientfile", metavar="FILENAME",
- dest="config_filename",
- default=os.environ.get("GCLIENT_FILE", ".gclient"),
- help="Specify an alternate .gclient file")
+ parser.add_option('-v', '--verbose', action='count', default=0,
+ help='Produces additional output for diagnostics. Can be '
+ 'used up to three times for more logging info.')
+ parser.add_option('--gclientfile', dest='config_filename',
+ default=os.environ.get('GCLIENT_FILE', '.gclient'),
+ help='Specify an alternate %default file')
# Integrate standard options processing.
old_parser = parser.parse_args
def Parse(args):
(options, args) = old_parser(args)
+ level = None
if options.verbose == 2:
- logging.basicConfig(level=logging.INFO)
+ level = logging.INFO
elif options.verbose > 2:
- logging.basicConfig(level=logging.DEBUG)
- options.entries_filename = options.config_filename + "_entries"
+ level = logging.DEBUG
+ logging.basicConfig(level=level,
+ format='%(module)s(%(lineno)d) %(funcName)s:%(message)s')
+ options.entries_filename = options.config_filename + '_entries'
if not hasattr(options, 'revisions'):
# GClient.RunOnDeps expects it even if not applicable.
options.revisions = []
if not hasattr(options, 'head'):
options.head = None
+ if not hasattr(options, 'nohooks'):
+ options.nohooks = True
+ if not hasattr(options, 'deps_os'):
+ options.deps_os = None
return (options, args)
parser.parse_args = Parse
# We don't want wordwrapping in epilog (usually examples)
@@ -1118,18 +1124,18 @@ def Main(argv):
if argv:
command = Command(argv[0])
if command:
- # "fix" the usage and the description now that we know the subcommand.
+ # 'fix' the usage and the description now that we know the subcommand.
GenUsage(parser, argv[0])
return command(parser, argv[1:])
# Not a known command. Default to help.
GenUsage(parser, 'help')
return CMDhelp(parser, argv)
except gclient_utils.Error, e:
- print >> sys.stderr, "Error: %s" % str(e)
+ print >> sys.stderr, 'Error: %s' % str(e)
return 1
-if "__main__" == __name__:
+if '__main__' == __name__:
sys.exit(Main(sys.argv[1:]))
# vim: ts=2:sw=2:tw=80:et:
« no previous file with comments | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698