diff options
author | joi@chromium.org <joi@chromium.org@7262f16d-afe8-6277-6482-052fa10e57b1> | 2014-01-02 16:05:39 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@7262f16d-afe8-6277-6482-052fa10e57b1> | 2014-01-02 16:05:39 +0000 |
commit | 19bf7c06d3192b2ac2fb7a7dd9775bc677636e3e (patch) | |
tree | a454c09d1ceb384af49b555a80d16e118558c57a | |
parent | 976a48583e8fb65888e9f660125231cee30eb04b (diff) | |
download | grit-19bf7c06d3192b2ac2fb7a7dd9775bc677636e3e.tar.gz |
Simplify how variable_map is initialized. Suggestion by thakis@chromium.org.
BUG=https://code.google.com/p/grit-i18n/issues/detail?id=23
Review URL: https://codereview.chromium.org/122253002
git-svn-id: http://grit-i18n.googlecode.com/svn/trunk@142 7262f16d-afe8-6277-6482-052fa10e57b1
-rw-r--r-- | grit/node/base.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/grit/node/base.py b/grit/node/base.py index b54ba79..3755240 100644 --- a/grit/node/base.py +++ b/grit/node/base.py @@ -469,21 +469,28 @@ class Node(object): return symbol in defs def pp_if(symbol): return defs.get(symbol, False) - platform_assertion = Node.GetPlatformAssertion(target_platform) variable_map = { 'defs' : defs, 'os': target_platform, - 'is_linux': platform_assertion == 'is_linux', - 'is_macosx': platform_assertion == 'is_macosx', - 'is_win': platform_assertion == 'is_win', - 'is_android': platform_assertion == 'is_android', - 'is_ios': platform_assertion == 'is_ios', - # is_posix is not mutually exclusive of the others + + # One of these is_xyz assertions gets set to True in the line + # following this initializer block. + 'is_linux': False, + 'is_macosx': False, + 'is_win': False, + 'is_android': False, + 'is_ios': False, + + # is_posix is not mutually exclusive of the others and gets + # set here, not below. 'is_posix': (target_platform in ('darwin', 'linux2', 'linux3', 'sunos5') or 'bsd' in sys.platform), + 'pp_ifdef' : pp_ifdef, 'pp_if' : pp_if, } + variable_map[Node.GetPlatformAssertion(target_platform)] = True + if extra_variables: variable_map.update(extra_variables) eval_result = cache_dict[expr] = eval(expr, {}, variable_map) |