Auto merge of #10617 - perlun:extract-build-properties-script-to-py-files, r=bholley

Extracted Mako-based code generation invokation to separate .py files.

This breaks out some of the parts on #10586, that should be easily mergeable (hopefully pretty much a no-brainer really). The idea would be to let you review & merge it first, and then I'll complete the other PR rebase off of this stuff.

@bholley - I did like you suggested and broke it out for `geckolib` as well. The tests should also be running without problems (tested `./mach test-unit` locally).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10617)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-15 04:50:47 +05:30
commit 0c51259e40
4 changed files with 41 additions and 32 deletions

View file

@ -43,19 +43,7 @@ fn main() {
.env("PYTHONPATH", &mako)
.env("TEMPLATE", &template)
.env("PRODUCT", product)
.arg("-c")
.arg(r#"
import os
import sys
from mako.template import Template
from mako import exceptions
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)
"#)
.arg("generate_properties_rs.py")
.stderr(Stdio::inherit())
.output()
.unwrap();

View file

@ -0,0 +1,17 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
from mako import exceptions
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)