Skip to content

Commit

Permalink
Remove sys.exit from parse_until_resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed May 20, 2024
1 parent c812c85 commit 697a07b
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,19 +1287,20 @@ def parse_until_resolved(
):
"""variant contains key-value mapping for additional functions and values
for jinja2 variables"""
# undefined_jinja_vars is refreshed by self.parse again
undefined_jinja_vars = ()
# store the "final" state that we think we're in. reloading the meta.yaml file
# can reset it (to True)
final = self.final
# always parse again at least once.

# always parse again at least once
self.parse_again(
permit_undefined_jinja=True,
allow_no_other_outputs=allow_no_other_outputs,
bypass_env_check=bypass_env_check,
)
self.final = final

# recursively parse again so long as each iteration has fewer undefined jinja variables
undefined_jinja_vars = ()
while set(undefined_jinja_vars) != set(self.undefined_jinja_vars):
undefined_jinja_vars = self.undefined_jinja_vars
self.parse_again(
Expand All @@ -1308,18 +1309,8 @@ def parse_until_resolved(
bypass_env_check=bypass_env_check,
)
self.final = final
if undefined_jinja_vars:
self.parse_again(
permit_undefined_jinja=False,
allow_no_other_outputs=allow_no_other_outputs,
bypass_env_check=bypass_env_check,
)
sys.exit(
f"Undefined Jinja2 variables remain ({self.undefined_jinja_vars}). Please enable "
"source downloading and try again."
)

# always parse again at the end, too.
# always parse again at the end without permit_undefined_jinja
self.parse_again(
permit_undefined_jinja=False,
allow_no_other_outputs=allow_no_other_outputs,
Expand Down

0 comments on commit 697a07b

Please sign in to comment.