Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Jan 8, 2025
1 parent 4bd96e7 commit 7bc0070
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/rattler_build_conda_compat/recipe_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def get_first_url(source: MutableMapping[str, Any]) -> str:
return (get_first_url(source) for source in get_all_sources(recipe) if "url" in source)


def render_all_sources(
def render_all_sources( # noqa: C901
recipe: RecipeWithContext,
variants: list[dict[str, list[str]]],
override_version: str | None = None,
Expand Down Expand Up @@ -152,12 +152,17 @@ def render(template: str | list[str], context: dict[str, str]) -> str | list[str
):
# we need to explicitly cast here
elem_dict = typing.cast(dict[str, Any], elem)
sha256, md5 = None, None
if elem_dict.get("sha256") is not None:
sha256 = typing.cast(str, render(str(elem_dict["sha256"]), context_variables))
if elem_dict.get("md5") is not None:
md5 = typing.cast(str, render(str(elem_dict["md5"]), context_variables))
if "url" in elem_dict:
as_url = Source(
url=render(elem_dict["url"], context_variables),
template=elem_dict["url"],
sha256=render(elem_dict.get("sha256"), context_variables),
md5=render(elem_dict.get("md5"), context_variables),
sha256=sha256,
md5=md5,
context=context_variables,
)
final_sources.add(as_url)
Expand Down

0 comments on commit 7bc0070

Please sign in to comment.