Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve properties.mako.rs file structure #10586

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/style/generate_properties_rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import sys

from mako import exceptions
from mako.lookup import TemplateLookup
from mako.template import Template

try:
lookup = TemplateLookup(directories=['.'])
template = Template(open(os.environ['TEMPLATE'], 'rb').read(),
input_encoding='utf8')
input_encoding='utf8',
lookup=lookup)
print(template.render(PRODUCT=os.environ['PRODUCT']).encode('utf8'))
except:
sys.stderr.write(exceptions.text_error_template().render().encode('utf8'))
Expand Down
7 changes: 6 additions & 1 deletion components/style/list_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

style = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(style, "Mako-0.9.1.zip"))

from mako.lookup import TemplateLookup
from mako.template import Template

template = Template(filename=os.path.join(style, "properties.mako.rs"), input_encoding='utf8')
lookup = TemplateLookup(directories=[style])
template = Template(filename=os.path.join(style, "properties.mako.rs"),
input_encoding='utf8',
lookup=lookup)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are needed to be able to use %include. It was significantly harder to be able to use it from list_properties.py, so in that sense your (Simon) change in the other branch where you refactor list_properties.py away is kind of nice.

template.render(PRODUCT='servo')
properties = dict(
(p.name, {
Expand Down
Loading