Skip to content
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

Try to render the recipe again if it requires downloading source #697

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions bioconda_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,32 @@ def load_all_meta(recipe, config=None, finalize=True):
# To avoid adding a separate `bypass_env_check` alongside every `finalize`
# parameter, just assume we always want to bypass if `finalize is True`.
bypass_env_check = (not finalize)
return [meta for (meta, _, _) in api.render(recipe,
config=config,
finalize=finalize,
bypass_env_check=bypass_env_check,
)]

def metas(config):
return [meta for (meta, _, _) in api.render(recipe,
config=config,
finalize=finalize,
bypass_env_check=bypass_env_check,
)]

try:
return metas(config)
except ValueError as error:
# Try again with downloading allowed if rendering the recipe requires
# downloading the source, e.g. if meta.yaml uses Conda's
# load_setup_py_data() function. The conditional targets the following
# exception:
#
# ValueError: no_download_source specified, but can't fully render
# recipe without downloading source. Please fix the recipe, or
# don't use no_download_source.
#
if str(error).startswith("no_download_source specified"):
logger.warn("Recipe appears to require downloading source; re-trying.")
config.no_download_source = False
return metas(config)
else:
raise


def load_meta_fast(recipe: str, env=None):
Expand Down