-
Notifications
You must be signed in to change notification settings - Fork 10
support variant variables in sources #66
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
base: main
Are you sure you want to change the base?
Conversation
@@ -138,7 +138,7 @@ def render(template: str | list[str], context: dict[str, str]) -> str | list[str | |||
|
|||
context = recipe.get("context", {}) | |||
# render out the context section and retrieve dictionary | |||
context_variables = load_recipe_context(context, env) | |||
context_variables = combination | load_recipe_context(context, env) |
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.
This means that the variant variables are passed as context to the Source object below. Is this correct?
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.
This |
doesn't appear to be required, as the combination
is already present in env.globals
. I removed this, and still got the expected URLs from variants.
Maybe the template.render(context)
fix was all that was required for this?
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.
actually, the test added in this repo passes with no changes (even the clear context_variables
bug you found). That, to me, suggests that if this is doing something wrong in the bot, maybe the variants are not being passed the same? At least, it would suggest the test isn't precisely covering the failing situation.
@@ -125,7 +125,7 @@ def render(template: str | list[str], context: dict[str, str]) -> str | list[str | |||
if isinstance(template, list): | |||
return [cast(str, render(t, context)) for t in template] | |||
template = env.from_string(template) | |||
return template.render(context_variables) | |||
return template.render(context) |
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.
I think this was actually a bug?
@wolfv any updates here? |
This PR is intended as more of a question than a concrete proposal.
Currently,
render_all_sources
does not render variables in source URLs defined by variant variables (as opposed to variables defined in the source section). However, rattler-build supports variant variables in the source section (see, e.g., https://github.com/conda-forge/polars-feedstock/pull/303/checks?check_run_id=35876450902).Does it make sense to support variant variables here too? This would enable the autotick-bot to parse such recipes.