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

Side by Side Diff: depot-tools-auth.py

Issue 1851283002: Fix coloring madness in depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Improve logic a bit Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | gclient.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Manages cached OAuth2 tokens used by other depot_tools scripts. 6 """Manages cached OAuth2 tokens used by other depot_tools scripts.
7 7
8 Usage: 8 Usage:
9 depot-tools-auth login codereview.chromium.org 9 depot-tools-auth login codereview.chromium.org
10 depot-tools-auth info codereview.chromium.org 10 depot-tools-auth info codereview.chromium.org
11 depot-tools-auth logout codereview.chromium.org 11 depot-tools-auth logout codereview.chromium.org
12 """ 12 """
13 13
14 import logging 14 import logging
15 import optparse 15 import optparse
16 import sys 16 import sys
17 import os 17 import os
18 18
19 from third_party import colorama
20
21 import auth 19 import auth
20 import setup_color
22 import subcommand 21 import subcommand
23 22
24 __version__ = '1.0' 23 __version__ = '1.0'
25 24
26 25
27 @subcommand.usage('<hostname>') 26 @subcommand.usage('<hostname>')
28 def CMDlogin(parser, args): 27 def CMDlogin(parser, args):
29 """Performs interactive login and caches authentication token.""" 28 """Performs interactive login and caches authentication token."""
30 # Forcefully relogin, revoking previous token. 29 # Forcefully relogin, revoking previous token.
31 hostname, authenticator = parser.parse_args(args) 30 hostname, authenticator = parser.parse_args(args)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 def main(argv): 87 def main(argv):
89 dispatcher = subcommand.CommandDispatcher(__name__) 88 dispatcher = subcommand.CommandDispatcher(__name__)
90 try: 89 try:
91 return dispatcher.execute(OptionParser(), argv) 90 return dispatcher.execute(OptionParser(), argv)
92 except auth.AuthenticationError as e: 91 except auth.AuthenticationError as e:
93 print >> sys.stderr, e 92 print >> sys.stderr, e
94 return 1 93 return 1
95 94
96 95
97 if __name__ == '__main__': 96 if __name__ == '__main__':
98 colorama.init(wrap="TERM" not in os.environ) 97 setup_color.init()
99 try: 98 try:
100 sys.exit(main(sys.argv[1:])) 99 sys.exit(main(sys.argv[1:]))
101 except KeyboardInterrupt: 100 except KeyboardInterrupt:
102 sys.stderr.write('interrupted\n') 101 sys.stderr.write('interrupted\n')
103 sys.exit(1) 102 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | gclient.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698