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

Side by Side Diff: roll_dep.py

Issue 1150413002: Also handle IOError in roll_dep.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 7 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 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 """Rolls DEPS controlled dependency. 6 """Rolls DEPS controlled dependency.
7 7
8 Works only with git checkout and git dependencies. 8 Works only with git checkout and git dependencies.
9 """ 9 """
10 10
(...skipping 10 matching lines...) Expand all
21 return not ( 21 return not (
22 subprocess.check_output(cmd, cwd=root).strip() or 22 subprocess.check_output(cmd, cwd=root).strip() or
23 subprocess.check_output(cmd + ['--cached'], cwd=root).strip()) 23 subprocess.check_output(cmd + ['--cached'], cwd=root).strip())
24 24
25 25
26 def roll(root, deps_dir, key, reviewers, bug): 26 def roll(root, deps_dir, key, reviewers, bug):
27 deps = os.path.join(root, 'DEPS') 27 deps = os.path.join(root, 'DEPS')
28 try: 28 try:
29 with open(deps, 'rb') as f: 29 with open(deps, 'rb') as f:
30 deps_content = f.read() 30 deps_content = f.read()
31 except OSError: 31 except (IOError, OSError):
32 print >> sys.stderr, ( 32 print >> sys.stderr, (
33 'Ensure the script is run in the directory containing DEPS file.') 33 'Ensure the script is run in the directory containing DEPS file.')
34 return 1 34 return 1
35 35
36 if not is_pristine(root): 36 if not is_pristine(root):
37 print >> sys.stderr, 'Ensure %s is clean first.' % root 37 print >> sys.stderr, 'Ensure %s is clean first.' % root
38 return 1 38 return 1
39 39
40 full_dir = os.path.join(os.path.dirname(root), deps_dir) 40 full_dir = os.path.join(os.path.dirname(root), deps_dir)
41 head = subprocess.check_output( 41 head = subprocess.check_output(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return roll( 130 return roll(
131 os.getcwd(), 131 os.getcwd(),
132 args[0], 132 args[0],
133 args[1] if len(args) > 1 else None, 133 args[1] if len(args) > 1 else None,
134 reviewers, 134 reviewers,
135 options.bug) 135 options.bug)
136 136
137 137
138 if __name__ == '__main__': 138 if __name__ == '__main__':
139 sys.exit(main()) 139 sys.exit(main())
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