Skip to content

Commit

Permalink
fix: use a more specific regex for jinja2 set statements
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr authored Oct 23, 2024
1 parent ebaf9ed commit 4db19c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion conda_build/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def find_used_variables_in_text(variant, recipe_text, selectors_only=False):
# TODO: this `for` regex won't catch some common cases like lists of vars, multiline
# jinja2 blocks, if filters on the for loop, etc.
for_regex = r"(?:^|[^\{])\{%\s*for\s*.*\s*in\s*" + v_regex + r"(?:[^%]*?)?%\}"
set_regex = r"(?:^|[^\{])\{%\s*set\s*.*\s*=\s*.*" + v_regex + r"(?:[^%]*?)?%\}"
set_regex = r"(?:^|[^\{])\{%\s*set\s*.*\s*=\s*.*" + v_regex + r"(?![a-zA-Z_0-9])(?:[^%]*?)?%\}"
# plain req name, no version spec. Look for end of line after name, or comment or selector
requirement_regex = rf"^\s+\-\s+{v_req_regex}\s*(?:\s[\[#]|$)"
if selectors_only:
Expand Down

0 comments on commit 4db19c0

Please sign in to comment.