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

Side by Side Diff: git_cache.py

Issue 232093002: Fix to path search redux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """A git command for managing a local cache of git repositories.""" 6 """A git command for managing a local cache of git repositories."""
7 7
8 from __future__ import print_function 8 from __future__ import print_function
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 for path_folder in path_folders: 152 for path_folder in path_folders:
153 target = os.path.join(path_folder, executable) 153 target = os.path.join(path_folder, executable)
154 # Just incase we have some ~/blah paths. 154 # Just incase we have some ~/blah paths.
155 target = os.path.abspath(os.path.expanduser(target)) 155 target = os.path.abspath(os.path.expanduser(target))
156 if os.path.isfile(target) and os.access(target, os.X_OK): 156 if os.path.isfile(target) and os.access(target, os.X_OK):
157 return target 157 return target
158 if sys.platform.startswith('win'): 158 if sys.platform.startswith('win'):
159 for suffix in ('.bat', '.cmd', '.exe'): 159 for suffix in ('.bat', '.cmd', '.exe'):
160 alt_target = target + suffix 160 alt_target = target + suffix
161 if os.path.isfile(alt_target) and os.access(target, os.X_OK): 161 if os.path.isfile(alt_target) and os.access(alt_target, os.X_OK):
162 return alt_target 162 return alt_target
163 return None 163 return None
164 164
165 @classmethod 165 @classmethod
166 def SetCachePath(cls, cachepath): 166 def SetCachePath(cls, cachepath):
167 setattr(cls, 'cachepath', cachepath) 167 setattr(cls, 'cachepath', cachepath)
168 168
169 @classmethod 169 @classmethod
170 def GetCachePath(cls): 170 def GetCachePath(cls):
171 if not hasattr(cls, 'cachepath'): 171 if not hasattr(cls, 'cachepath'):
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 return options, args 490 return options, args
491 491
492 492
493 def main(argv): 493 def main(argv):
494 dispatcher = subcommand.CommandDispatcher(__name__) 494 dispatcher = subcommand.CommandDispatcher(__name__)
495 return dispatcher.execute(OptionParser(), argv) 495 return dispatcher.execute(OptionParser(), argv)
496 496
497 497
498 if __name__ == '__main__': 498 if __name__ == '__main__':
499 sys.exit(main(sys.argv[1:])) 499 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698