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

Side by Side Diff: gclient.py

Issue 385123008: Update recursedeps to support use_relative_path. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: update comment Created 6 years, 5 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
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | 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 (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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 'ParseDepsFile(%s): Strict mode disallows %r -> %r' % 588 'ParseDepsFile(%s): Strict mode disallows %r -> %r' %
589 (self.name, key, val)) 589 (self.name, key, val))
590 590
591 deps = local_scope.get('deps', {}) 591 deps = local_scope.get('deps', {})
592 if 'recursion' in local_scope: 592 if 'recursion' in local_scope:
593 self.recursion_override = local_scope.get('recursion') 593 self.recursion_override = local_scope.get('recursion')
594 logging.warning( 594 logging.warning(
595 'Setting %s recursion to %d.', self.name, self.recursion_limit) 595 'Setting %s recursion to %d.', self.name, self.recursion_limit)
596 self.recursedeps = local_scope.get('recursedeps', None) 596 self.recursedeps = local_scope.get('recursedeps', None)
597 if 'recursedeps' in local_scope: 597 if 'recursedeps' in local_scope:
598 self.recursedeps = set(self.recursedeps)
598 logging.warning('Found recursedeps %r.', repr(self.recursedeps)) 599 logging.warning('Found recursedeps %r.', repr(self.recursedeps))
599 # If present, save 'target_os' in the local_target_os property. 600 # If present, save 'target_os' in the local_target_os property.
600 if 'target_os' in local_scope: 601 if 'target_os' in local_scope:
601 self.local_target_os = local_scope['target_os'] 602 self.local_target_os = local_scope['target_os']
602 # load os specific dependencies if defined. these dependencies may 603 # load os specific dependencies if defined. these dependencies may
603 # override or extend the values defined by the 'deps' member. 604 # override or extend the values defined by the 'deps' member.
604 target_os_list = self.target_os 605 target_os_list = self.target_os
605 if 'deps_os' in local_scope and target_os_list: 606 if 'deps_os' in local_scope and target_os_list:
606 deps = self.MergeWithOsDeps(deps, local_scope['deps_os'], target_os_list) 607 deps = self.MergeWithOsDeps(deps, local_scope['deps_os'], target_os_list)
607 608
608 # If a line is in custom_deps, but not in the solution, we want to append 609 # If a line is in custom_deps, but not in the solution, we want to append
609 # this line to the solution. 610 # this line to the solution.
610 for d in self.custom_deps: 611 for d in self.custom_deps:
611 if d not in deps: 612 if d not in deps:
612 deps[d] = self.custom_deps[d] 613 deps[d] = self.custom_deps[d]
613 614
614 # If use_relative_paths is set in the DEPS file, regenerate 615 # If use_relative_paths is set in the DEPS file, regenerate
615 # the dictionary using paths relative to the directory containing 616 # the dictionary using paths relative to the directory containing
616 # the DEPS file. 617 # the DEPS file. Also update recursedeps if use_relative_paths is
618 # enabled.
617 use_relative_paths = local_scope.get('use_relative_paths', False) 619 use_relative_paths = local_scope.get('use_relative_paths', False)
618 if use_relative_paths: 620 if use_relative_paths:
621 logging.warning('use_relative_paths enabled.')
619 rel_deps = {} 622 rel_deps = {}
620 for d, url in deps.items(): 623 for d, url in deps.items():
621 # normpath is required to allow DEPS to use .. in their 624 # normpath is required to allow DEPS to use .. in their
622 # dependency local path. 625 # dependency local path.
623 rel_deps[os.path.normpath(os.path.join(self.name, d))] = url 626 rel_deps[os.path.normpath(os.path.join(self.name, d))] = url
627 logging.warning('Updating deps by prepending %s.', self.name)
624 deps = rel_deps 628 deps = rel_deps
625 629
630 # Update recursedeps if it's set.
631 if self.recursedeps is not None:
632 logging.warning('Updating recursedeps by prepending %s.', self.name)
633 rel_deps = set()
634 for d in self.recursedeps:
635 rel_deps.add(os.path.normpath(os.path.join(self.name, d)))
636 self.recursedeps = rel_deps
637
626 # Convert the deps into real Dependency. 638 # Convert the deps into real Dependency.
627 deps_to_add = [] 639 deps_to_add = []
628 for name, url in deps.iteritems(): 640 for name, url in deps.iteritems():
629 should_process = self.recursion_limit and self.should_process 641 should_process = self.recursion_limit and self.should_process
630 deps_to_add.append(Dependency( 642 deps_to_add.append(Dependency(
631 self, name, url, None, None, None, None, None, 643 self, name, url, None, None, None, None, None,
632 self.deps_file, should_process)) 644 self.deps_file, should_process))
633 deps_to_add.sort(key=lambda x: x.name) 645 deps_to_add.sort(key=lambda x: x.name)
634 646
635 # override named sets of hooks by the custom hooks 647 # override named sets of hooks by the custom hooks
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 print >> sys.stderr, 'Error: %s' % str(e) 2057 print >> sys.stderr, 'Error: %s' % str(e)
2046 return 1 2058 return 1
2047 finally: 2059 finally:
2048 gclient_utils.PrintWarnings() 2060 gclient_utils.PrintWarnings()
2049 2061
2050 2062
2051 if '__main__' == __name__: 2063 if '__main__' == __name__:
2052 sys.exit(Main(sys.argv[1:])) 2064 sys.exit(Main(sys.argv[1:]))
2053 2065
2054 # vim: ts=2:sw=2:tw=80:et: 2066 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698