Commit a3b67ae2 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Commit Bot

gclient: predefine host_os

Bug: 570091
Change-Id: Ib2606fcc7251221ae10a0ef18b6585841d18eef4
Reviewed-on: https://chromium-review.googlesource.com/641750
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
parent 3414ad2c
......@@ -1150,11 +1150,28 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
def get_vars(self):
"""Returns a dictionary of effective variable values
(DEPS file contents with applied custom_vars overrides)."""
result = dict(self._vars)
# Provide some built-in variables.
result = {
'host_os': repr(_detect_host_os()),
}
# Variables defined in DEPS file override built-in ones.
result.update(self._vars)
result.update(self.custom_vars or {})
return result
_PLATFORM_MAPPING = {
'cygwin': 'win',
'darwin': 'mac',
'linux2': 'linux',
'win32': 'win',
}
def _detect_host_os():
return _PLATFORM_MAPPING[sys.platform]
class GClient(Dependency):
"""Object that represent a gclient checkout. A tree of Dependency(), one per
solution or DEPS entry."""
......@@ -1841,7 +1858,8 @@ class Flattener(object):
self._allowed_hosts.update(dep.allowed_hosts)
for key, value in dep.get_vars().iteritems():
# Only include vars listed in the DEPS files, not possible local overrides.
for key, value in dep._vars.iteritems():
# Make sure there are no conflicting variables. It is fine however
# to use same variable name, as long as the value is consistent.
assert key not in self._vars or self._vars[key][1] == value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment