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: gclient_utils.py

Issue 2867047: Bring some OOP and sanity to gclient.py. (Closed)
Patch Set: Reuse old code Created 10 years, 5 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 | « gclient.py ('k') | tests/gclient_smoketest.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 # Copyright 2009 Google Inc. All Rights Reserved. 1 # Copyright 2009 Google Inc. All Rights Reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if rv: 303 if rv:
304 msg = 'failed to run command: %s' % ' '.join(command) 304 msg = 'failed to run command: %s' % ' '.join(command)
305 305
306 if fail_status != None: 306 if fail_status != None:
307 print >>sys.stderr, msg 307 print >>sys.stderr, msg
308 sys.exit(fail_status) 308 sys.exit(fail_status)
309 309
310 raise Error(msg) 310 raise Error(msg)
311 311
312 312
313 def IsUsingGit(root, paths):
314 """Returns True if we're using git to manage any of our checkouts.
315 |entries| is a list of paths to check."""
316 for path in paths:
317 if os.path.exists(os.path.join(root, path, '.git')):
318 return True
319 return False
320
321 def FindGclientRoot(from_dir, filename='.gclient'): 313 def FindGclientRoot(from_dir, filename='.gclient'):
322 """Tries to find the gclient root.""" 314 """Tries to find the gclient root."""
323 path = os.path.realpath(from_dir) 315 path = os.path.realpath(from_dir)
324 while not os.path.exists(os.path.join(path, filename)): 316 while not os.path.exists(os.path.join(path, filename)):
325 next = os.path.split(path) 317 next = os.path.split(path)
326 if not next[1]: 318 if not next[1]:
327 return None 319 return None
328 path = next[0] 320 path = next[0]
329 logging.info('Found gclient root at ' + path) 321 logging.info('Found gclient root at ' + path)
330 return path 322 return path
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 config_path = FindFileUpwards(config_file, path) 356 config_path = FindFileUpwards(config_file, path)
365 357
366 if not config_path: 358 if not config_path:
367 print "Can't find %s" % config_file 359 print "Can't find %s" % config_file
368 return None 360 return None
369 361
370 env = {} 362 env = {}
371 execfile(config_path, env) 363 execfile(config_path, env)
372 config_dir = os.path.dirname(config_path) 364 config_dir = os.path.dirname(config_path)
373 return config_dir, env['entries'] 365 return config_dir, env['entries']
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698