Commit ae047d1b authored by tc@google.com's avatar tc@google.com

Add os support to grit so we can conditionally include resources based on

platform.

Review URL: http://codereview.chromium.org/28237


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10556 0039d316-1c4b-4281-b951-d872f2087c98
parent 6b01b109
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
<include name="IDR_CREDITS_HTML" file="resources\about_credits.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_CREDITS_HTML" file="resources\about_credits.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_HISTORY_HTML" file="resources\history.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_HISTORY_HTML" file="resources\history.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_DOWNLOADS_HTML" file="resources\downloads.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_DOWNLOADS_HTML" file="resources\downloads.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_LINUX_SPLASH_HTML" file="resources\linux-splash.html" flattenhtml="true" type="BINDATA" /> <if expr="os == 'linux2'">
<include name="IDR_LINUX_SPLASH_HTML" file="resources\linux-splash.html" flattenhtml="true" type="BINDATA" />
</if>
</includes> </includes>
</release> </release>
</grit> </grit>
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
''' '''
import os import os
import sys
import types import types
from xml.sax import saxutils from xml.sax import saxutils
...@@ -459,6 +460,7 @@ class Node(grit.format.interface.ItemFormatter): ...@@ -459,6 +460,7 @@ class Node(grit.format.interface.ItemFormatter):
The expression is given a few local variables: The expression is given a few local variables:
- 'lang' is the language currently being output - 'lang' is the language currently being output
- 'defs' is a map of C preprocessor-style define names to their values - 'defs' is a map of C preprocessor-style define names to their values
- 'os' is the current platform (likely 'linux2', 'win32' or 'darwin').
- 'pp_ifdef(define)' which behaves just like the C preprocessors #ifdef, - 'pp_ifdef(define)' which behaves just like the C preprocessors #ifdef,
i.e. it is shorthand for "define in defs" i.e. it is shorthand for "define in defs"
- 'pp_if(define)' which behaves just like the C preprocessor's #if, i.e. - 'pp_if(define)' which behaves just like the C preprocessor's #if, i.e.
...@@ -478,6 +480,7 @@ class Node(grit.format.interface.ItemFormatter): ...@@ -478,6 +480,7 @@ class Node(grit.format.interface.ItemFormatter):
return eval(expr, {}, return eval(expr, {},
{'lang' : lang, {'lang' : lang,
'defs' : defs, 'defs' : defs,
'os': sys.platform,
'pp_ifdef' : pp_ifdef, 'pp_ifdef' : pp_ifdef,
'pp_if' : pp_if}) 'pp_if' : pp_if})
......
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