Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Meta checkout manager supporting both Subversion and GIT.""" | 6 """Meta checkout manager supporting both Subversion and GIT.""" |
| 7 # Files | 7 # Files |
| 8 # .gclient : Current client configuration, written by 'config' command. | 8 # .gclient : Current client configuration, written by 'config' command. |
| 9 # Format is a Python script defining 'solutions', a list whose | 9 # Format is a Python script defining 'solutions', a list whose |
| 10 # entries each are maps binding the strings "name" and "url" | 10 # entries each are maps binding the strings "name" and "url" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 new_deps.update(target_os_deps) | 528 new_deps.update(target_os_deps) |
| 529 return new_deps | 529 return new_deps |
| 530 | 530 |
| 531 def ParseDepsFile(self): | 531 def ParseDepsFile(self): |
| 532 """Parses the DEPS file for this dependency.""" | 532 """Parses the DEPS file for this dependency.""" |
| 533 assert not self.deps_parsed | 533 assert not self.deps_parsed |
| 534 assert not self.dependencies | 534 assert not self.dependencies |
| 535 | 535 |
| 536 deps_content = None | 536 deps_content = None |
| 537 use_strict = False | 537 use_strict = False |
| 538 filepath = os.path.join(self.root.root_dir, self.name, self.deps_file) | 538 |
| 539 if not os.path.isfile(filepath): | 539 # First try to locate the configured deps file. If it's missing, fallback |
| 540 # to DEPS. | |
| 541 deps_files = set([self.deps_file, 'DEPS']) | |
|
iannucci
2014/07/01 22:13:58
yeah but order is still important and set() orderi
| |
| 542 for deps_file in deps_files: | |
| 543 filepath = os.path.join(self.root.root_dir, self.name, deps_file) | |
| 544 if os.path.isfile(filepath): | |
| 545 logging.info( | |
| 546 'ParseDepsFile(%s): %s file found at %s' % ( | |
| 547 self.name, deps_file, filepath)) | |
| 548 break | |
| 540 logging.info( | 549 logging.info( |
| 541 'ParseDepsFile(%s): No %s file found at %s' % ( | 550 'ParseDepsFile(%s): No %s file found at %s' % ( |
| 542 self.name, self.deps_file, filepath)) | 551 self.name, deps_file, filepath)) |
| 543 else: | 552 |
| 553 if os.path.isfile(filepath): | |
| 544 deps_content = gclient_utils.FileRead(filepath) | 554 deps_content = gclient_utils.FileRead(filepath) |
| 545 logging.debug('ParseDepsFile(%s) read:\n%s' % (self.name, deps_content)) | 555 logging.debug('ParseDepsFile(%s) read:\n%s' % (self.name, deps_content)) |
| 546 use_strict = 'use strict' in deps_content.splitlines()[0] | 556 use_strict = 'use strict' in deps_content.splitlines()[0] |
| 547 | 557 |
| 548 local_scope = {} | 558 local_scope = {} |
| 549 if deps_content: | 559 if deps_content: |
| 550 # One thing is unintuitive, vars = {} must happen before Var() use. | 560 # One thing is unintuitive, vars = {} must happen before Var() use. |
| 551 var = self.VarImpl(self.custom_vars, local_scope) | 561 var = self.VarImpl(self.custom_vars, local_scope) |
| 552 if use_strict: | 562 if use_strict: |
| 553 logging.info( | 563 logging.info( |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2033 print >> sys.stderr, 'Error: %s' % str(e) | 2043 print >> sys.stderr, 'Error: %s' % str(e) |
| 2034 return 1 | 2044 return 1 |
| 2035 finally: | 2045 finally: |
| 2036 gclient_utils.PrintWarnings() | 2046 gclient_utils.PrintWarnings() |
| 2037 | 2047 |
| 2038 | 2048 |
| 2039 if '__main__' == __name__: | 2049 if '__main__' == __name__: |
| 2040 sys.exit(Main(sys.argv[1:])) | 2050 sys.exit(Main(sys.argv[1:])) |
| 2041 | 2051 |
| 2042 # vim: ts=2:sw=2:tw=80:et: | 2052 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |