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

Unified Diff: gclient.py

Issue 11246004: Allow DEPS file to specify 'target_os'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix a comment Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index ab52cc8eee6098eed83c4ce41dd652606ebf4bea..a91c61b32bf45253a9bedf9a8f39b909ec317bdb 100644
--- a/gclient.py
+++ b/gclient.py
@@ -172,6 +172,9 @@ class DependencySettings(GClientKeywords):
# dependency. It is read from the actual DEPS file so cannot be set on
# class instantiation.
self.recursion_override = None
+ # This is a mutable value which has the list of 'target_os' OSes listed in
+ # the current deps file.
+ self.local_target_os = None
# These are only set in .gclient and not in DEPS files.
self._custom_vars = custom_vars or {}
@@ -239,6 +242,13 @@ class DependencySettings(GClientKeywords):
return self.recursion_override
return max(self.parent.recursion_limit - 1, 0)
+ @property
+ def target_os(self):
+ if self.local_target_os is not None:
+ return tuple(set(self.local_target_os).union(self.parent.target_os))
+ else:
+ return self.parent.target_os
+
def get_custom_deps(self, name, url):
"""Returns a custom deps if applicable."""
if self.parent:
@@ -455,13 +465,15 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self.recursion_override = local_scope.get('recursion')
logging.warning(
'Setting %s recursion to %d.', self.name, self.recursion_limit)
+ # If present, save 'target_os' in the local_target_os property.
+ if 'target_os' in local_scope:
+ self.local_target_os = local_scope['target_os']
# load os specific dependencies if defined. these dependencies may
# override or extend the values defined by the 'deps' member.
if 'deps_os' in local_scope:
- enforced_os = self.root.enforced_os
- for deps_os_key in enforced_os:
+ for deps_os_key in self.target_os:
os_deps = local_scope['deps_os'].get(deps_os_key, {})
- if len(enforced_os) > 1:
+ if len(self.target_os) > 1:
# Ignore any conflict when including deps for more than one
# platform, so we collect the broadest set of dependencies
# available. We may end up with the wrong revision of something for
@@ -1166,6 +1178,10 @@ solutions = [
"""How recursive can each dependencies in DEPS file can load DEPS file."""
return self._recursion_limit
+ @property
+ def target_os(self):
+ return self._enforced_os
+
#### gclient commands.
« 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