-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat: delay jinja evaluation for script #894
Conversation
Something that we might want to think about is that this does not solve the case for e.g. |
We could still add the
|
Or we change the way we do activation completely (to work like pixi) and add everything to the Jinja context :) |
To me, from a user perspective, this makes the most sense. Adding all the environment variables after activation to the It might also be slightly confusing to users which variables are available when but at least we provide a consistent way to access environment variables. |
Would this have an expanded path hard-coded when the recipe is rendered? That would make rebuilding a conda package like with reproducible-builds impossible. |
Actually, it's a requirement for the reproducible builds to build the packages in the exact same prefix regardless, so that's not really an issue. A lot of packages ship files with the prefix in some text files (such as |
c89a5f6
to
484212b
Compare
This delays the Jinja evaluation for the
script
contents. That means that we can also inject a lot of variables into the script by usingjinja
.Such as
${{ PREFIX }}
or${{ PYTHON }}
.For example the following two examples work on Windows and on Unix:
These variables are also available as environment variables. However, since we are using
cmd.exe
andbash
on the different operating systems, the syntax to expand environment variables is not the same (%PREFIX%
vs$PREFIX
).Alternatives we considered (or are considering):
env("PREFIX")
that expands to either%PREFIX%
or$PREFIX
depending on execution context. Might not work well with different interpreters.$PREFIX
to%PREFIX%
as a string replacement on cmd.exeTODO
context