OLD | NEW |
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 Loading... |
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 Loading... |
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()) |
OLD | NEW |