forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted Mako compilation to separate .py files.
This breaks out some of the parts on servo#10586, that should be easily mergeable. The idea would be to let you review & merge it first, and then I'll complete the other PR rebase off of this stuff.
- Loading branch information
Showing
4 changed files
with
35 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
import sys | ||
|
||
from mako import exceptions | ||
from mako.lookup import TemplateLookup | ||
from mako.template import Template | ||
|
||
try: | ||
template = Template(open(os.environ['TEMPLATE'], 'rb').read(), | ||
input_encoding='utf8') | ||
print(template.render(PRODUCT=os.environ['PRODUCT']).encode('utf8')) | ||
except: | ||
sys.stderr.write(exceptions.text_error_template().render().encode('utf8')) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
import os | ||
import sys | ||
|
||
from mako import exceptions | ||
from mako.lookup import TemplateLookup | ||
from mako.template import Template | ||
|
||
try: | ||
style_template = Template(filename=os.environ['STYLE_TEMPLATE'], | ||
input_encoding='utf8') | ||
style_template.render(PRODUCT='gecko') | ||
|
||
geckolib_template = Template(filename=os.environ['GECKOLIB_TEMPLATE'], input_encoding='utf8') | ||
output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS) | ||
print(output.encode('utf8')) | ||
except: | ||
sys.stderr.write(exceptions.text_error_template().render().encode('utf8')) | ||
sys.exit(1) |