-
Notifications
You must be signed in to change notification settings - Fork 989
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
[question] Include jinja profile template into another #16561
Comments
Okay, after a bit of investigation, it is not a limitation of Conan, but of Jinja. It does not natively support absolute paths given to |
Hi @donlk Have you tried the Something like: global_conf = textwrap.dedent("""\
{% include "user_global.conf" %}
{% import "user_global.conf" as vars %}
user.mycompany:dist = {{vars.myvar*2}}
""")
user_global_conf = textwrap.dedent("""\
{% set myvar = 42 %}
user.mycompany:parallel = {{myvar}}
""") The absolute path might still be an issue, but it allows to read and use vars from other file. |
This would make it much more complex than it needs to be. |
It depends. In general I try to avoid inheritance and prefer composition when possible. Not only in code, but inheritance in data-oriented files can also have its challenges. By the way, the |
Theoretically this is still a composition if I use the
I did. It did not expand |
I am talking about "prefer composition over inheritance" pattern, the So far I don't see other alternative than using relative paths, but is this also an issue? Why isn't it possible to put the profiles in the same folder, or at least in known relative locations? |
Profile usage gets complicated when every developer has it's own profile containing not just the binary and flag definitions but the hard-coded filesystem paths too. It gets chaotic pretty fast. Thanks! Closing. |
What is your question?
Hi!
I think I had a related question a few years back, but maybe not this one in particular.
I have a jinja2 profile template:
And a concrete one, in a completely different folder only defining
toolchain_path
:I want to include
gcc-template.jinja
intogcc-concrete.jinja
and havetoolchain_path
expanded. I've read about the include() directive here, but that doesn't work,toolchain_path
does not get expanded, no matter where theinclude()
is.It seems I cannot use
{% include <path>/gcc-template.jinja %}
(orextends
) either, as I get an error:Jinja2
include
andextends
are completely valid in standard jinja2, I don't know why they give me errors here.Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: