OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 Google Inc. | 2 # Copyright 2014 Google Inc. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 """Parse a DEPS file and git checkout all of the dependencies. | 8 """Parse a DEPS file and git checkout all of the dependencies. |
9 | 9 |
10 Args: | 10 Args: |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 dictionary in the DEPS file. | 165 dictionary in the DEPS file. |
166 | 166 |
167 Raises DepsError exception and git Exceptions. | 167 Raises DepsError exception and git Exceptions. |
168 """ | 168 """ |
169 git = git_executable() | 169 git = git_executable() |
170 assert git | 170 assert git |
171 | 171 |
172 deps_file_directory = os.path.dirname(deps_file_path) | 172 deps_file_directory = os.path.dirname(deps_file_path) |
173 deps = parse_file_to_dict(deps_file_path) | 173 deps = parse_file_to_dict(deps_file_path) |
174 dependencies = deps['deps'].copy() | 174 dependencies = deps['deps'].copy() |
175 for deps_os in deps_os_list: | 175 if 'deps_os' in deps: |
176 # Add OS-specific dependencies | 176 for deps_os in deps_os_list: |
mtklein
2014/08/26 18:44:27
deps_os -> os;
deps_os_list -> command_line_os_re
| |
177 if deps_os not in deps['deps_os']: | 177 # Add OS-specific dependencies |
178 raise DepsError( | 178 if deps_os in deps['deps_os']: |
mtklein
2014/08/26 18:44:27
deps -> deps_file
| |
179 'Argument "%s" not found within deps_os keys %r' % | 179 for dep in deps['deps_os'][deps_os]: |
180 (deps_os, deps['deps_os'].keys())) | 180 dependencies[dep] = deps['deps_os'][deps_os][dep] |
mtklein
2014/08/26 18:44:27
dependencies.update(deps['deps_os'][deps_os])
| |
181 for dep in deps['deps_os'][deps_os]: | |
182 dependencies[dep] = deps['deps_os'][deps_os][dep] | |
183 list_of_arg_lists = [] | 181 list_of_arg_lists = [] |
184 for directory in dependencies: | 182 for directory in dependencies: |
185 if '@' in dependencies[directory]: | 183 if '@' in dependencies[directory]: |
186 repo, checkoutable = dependencies[directory].split('@', 1) | 184 repo, checkoutable = dependencies[directory].split('@', 1) |
187 else: | 185 else: |
188 repo, checkoutable = dependencies[directory], 'origin/master' | 186 repo, checkoutable = dependencies[directory], 'origin/master' |
189 | 187 |
190 relative_directory = os.path.join(deps_file_directory, directory) | 188 relative_directory = os.path.join(deps_file_directory, directory) |
191 | 189 |
192 list_of_arg_lists.append( | 190 list_of_arg_lists.append( |
(...skipping 25 matching lines...) Expand all Loading... | |
218 try: | 216 try: |
219 git_sync_deps(deps_file_path, argv, verbose) | 217 git_sync_deps(deps_file_path, argv, verbose) |
220 return 0 | 218 return 0 |
221 except DepsError: | 219 except DepsError: |
222 usage(deps_file_path) | 220 usage(deps_file_path) |
223 return 1 | 221 return 1 |
224 | 222 |
225 | 223 |
226 if __name__ == '__main__': | 224 if __name__ == '__main__': |
227 exit(main(sys.argv[1:])) | 225 exit(main(sys.argv[1:])) |
OLD | NEW |