| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 else: | 187 else: |
| 188 repo, checkoutable = dependencies[directory], 'origin/master' | 188 repo, checkoutable = dependencies[directory], 'origin/master' |
| 189 | 189 |
| 190 relative_directory = os.path.join(deps_file_directory, directory) | 190 relative_directory = os.path.join(deps_file_directory, directory) |
| 191 | 191 |
| 192 list_of_arg_lists.append( | 192 list_of_arg_lists.append( |
| 193 (git, repo, checkoutable, relative_directory, verbose)) | 193 (git, repo, checkoutable, relative_directory, verbose)) |
| 194 | 194 |
| 195 multithread(git_checkout_to_directory, list_of_arg_lists) | 195 multithread(git_checkout_to_directory, list_of_arg_lists) |
| 196 | 196 |
| 197 for directory in deps.get('recursedeps', []): |
| 198 recursive_path = os.path.join(deps_file_directory, directory, 'DEPS') |
| 199 git_sync_deps(recursive_path, deps_os_list, verbose) |
| 200 |
| 197 | 201 |
| 198 def multithread(function, list_of_arg_lists): | 202 def multithread(function, list_of_arg_lists): |
| 199 # for args in list_of_arg_lists: | 203 # for args in list_of_arg_lists: |
| 200 # function(*args) | 204 # function(*args) |
| 201 # return | 205 # return |
| 202 threads = [] | 206 threads = [] |
| 203 for args in list_of_arg_lists: | 207 for args in list_of_arg_lists: |
| 204 thread = threading.Thread(None, function, None, args) | 208 thread = threading.Thread(None, function, None, args) |
| 205 thread.start() | 209 thread.start() |
| 206 threads.append(thread) | 210 threads.append(thread) |
| 207 for thread in threads: | 211 for thread in threads: |
| 208 thread.join() | 212 thread.join() |
| 209 | 213 |
| 210 | 214 |
| 211 def main(argv): | 215 def main(argv): |
| 212 deps_file_path = os.environ.get('GIT_SYNC_DEPS_PATH', DEFAULT_DEPS_PATH) | 216 deps_file_path = os.environ.get('GIT_SYNC_DEPS_PATH', DEFAULT_DEPS_PATH) |
| 213 verbose = not bool(os.environ.get('GIT_SYNC_DEPS_QUIET', False)) | 217 verbose = not bool(os.environ.get('GIT_SYNC_DEPS_QUIET', False)) |
| 214 try: | 218 try: |
| 215 git_sync_deps(deps_file_path, argv, verbose) | 219 git_sync_deps(deps_file_path, argv, verbose) |
| 216 return 0 | 220 return 0 |
| 217 except DepsError: | 221 except DepsError: |
| 218 usage(deps_file_path) | 222 usage(deps_file_path) |
| 219 return 1 | 223 return 1 |
| 220 | 224 |
| 221 | 225 |
| 222 if __name__ == '__main__': | 226 if __name__ == '__main__': |
| 223 exit(main(sys.argv[1:])) | 227 exit(main(sys.argv[1:])) |
| OLD | NEW |