-
Notifications
You must be signed in to change notification settings - Fork 3k
Exporters: make jinja engine strict #3608
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
Conversation
- configure the jinja Environment to raise exception when substitution variables are not defined - trim spaces and lines, to avoid empty lines in generated files
in case they don't, you can make this an optional feature, and activate it only in the exporters that work. similarly for the white space options, perhaps it would be better to set them in each exporter and pass them to the base class. |
Yeah, let me pull this down and test the exporters real quick. |
Also, The diff is great. Nice and simple. |
That IAR one is definitely a bug. |
CMSIS one also clearly a bug. |
it looks like you asked for some trouble with this patch... :-( in my opinion this setting should have been a jinja default, I fail to identify cases when ignoring missing definitions is acceptable. |
Yes I did. However, I think it's the good kind of trouble: it pointed out some bugs. |
And that's all of them! They all should export again without issue. /morph export-build |
@ilg-ul We're almost ready to get this in. Just waiting on CI. |
+1, thanks for enabling StrictUndefined |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 91 Exporter Build failed! |
It looks like removing all blank lines is really bad for Makefiles. |
@ilg-ul Would you mind if I made the boolean for removing empty lines and spaces optional and changed the makefiles to disable them? |
I would do the opposite, I would call |
|
sorry, I was cryptic. I mean calling
the gen_file() definition should use variable args, and pass everything to jinja, not only those two, in case more flags will be necessary. |
So: def gen(teplate_file, context, output, **kwargs):
...
template.render(... **kwargs) or thereabouts. |
hmmm... it looks I have difficulties to explain. only exporters that need additional jinga options pass them, all existing ones need pass nothing, as they do now, so jinja defaults will apply. |
as implementation, add |
Also, Github is not the best way to do IRC... I edited by comment, probably while you were typing up a response to the old version 😆 |
ok, go ahead with the changes. |
/morph export-build |
@ilg-ul I made the changes, could you review them? I want to make sure that we understood each other correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok, please don't forget to add the options to the GNU ARM Eclipse exporter later
Yup! I have made a note. |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 92 All exports and builds passed! |
Great! What next now? Do we patiently wait for the planets to align in order for the PR to be merged? Or we better hum some incantations to hurry things up? ;-) |
The incantation is: @sg- could you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from 38k ft.
Thank you, @sg-! FL 380 is pretty high. On the way to ISS? ;-) |
The next incantation should address the magic Merge button... |
any progress? |
thank you, Martin! |
variables are not defined