From 976bd6814917b979e49591826996557f2cc7a7d9 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 6 Nov 2024 13:59:38 -0800 Subject: [PATCH 1/2] Rename conda-build `.condarc` function This function isn't related to `.conda` any more. So rename for clarity. --- recipe/conda_forge_ci_setup/build_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/conda_forge_ci_setup/build_utils.py b/recipe/conda_forge_ci_setup/build_utils.py index e760d15c..aab096e7 100644 --- a/recipe/conda_forge_ci_setup/build_utils.py +++ b/recipe/conda_forge_ci_setup/build_utils.py @@ -113,7 +113,7 @@ def fail_if_travis_not_allowed_for_arch(config_file, feedstock_root): raise RuntimeError("Travis CI cannot be used on x86_64 in conda-forge!") -def maybe_use_dot_conda(feedstock_root): +def apply_cf_yml_condarc_settings(feedstock_root): """Maybe set the .condarc to use .conda files.""" if os.path.exists(os.path.join(feedstock_root, "conda-forge.yml")): with open(os.path.join(feedstock_root, "conda-forge.yml")) as f: @@ -142,7 +142,7 @@ def setup_conda_rc(feedstock_root, recipe_root, config_file): fail_if_travis_not_allowed_for_arch(config_file, feedstock_root) - maybe_use_dot_conda(feedstock_root) + apply_cf_yml_condarc_settings(feedstock_root) with open(config_file) as f: specific_config = safe_load(f) From 6d569b2bbadd0a6313dd54b5c5d00b0cc1d63b45 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 6 Nov 2024 14:39:29 -0800 Subject: [PATCH 2/2] Allow some `condarc` values in `conda-forge.yml` --- recipe/conda_forge_ci_setup/build_utils.py | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/recipe/conda_forge_ci_setup/build_utils.py b/recipe/conda_forge_ci_setup/build_utils.py index aab096e7..78058b88 100644 --- a/recipe/conda_forge_ci_setup/build_utils.py +++ b/recipe/conda_forge_ci_setup/build_utils.py @@ -26,6 +26,32 @@ } } +cf_allowed_condarc_keys = { + "allow_softlinks", + "always_copy", + "always_softlink", + # "conda_build" is handled separately + "default_threads", + "envvars_force_uppercase", + "execute_threads", + "extra_safety_checks", + "json", + "number_channel_notices", + "path_conflict", + "quiet", + "remote_backoff_factor", + "remote_connect_timeout_secs", + "remote_max_retries", + "repodata_use_zst", + "report_errors", + "safety_checks", + "separate_format_cache", + "shortcuts", + "unsatisfiable_hints", + "unsatisfiable_hints_check_depth", + "verify_threads", +} + cf_conda_build_defaults = {"pkg_format": "2", "zstd_compression_level": 19} DEFAULTS_ALLOWED_FEEDSTOCKS = { @@ -119,6 +145,17 @@ def apply_cf_yml_condarc_settings(feedstock_root): with open(os.path.join(feedstock_root, "conda-forge.yml")) as f: repo_config = safe_load(f) + conda_config_vars = repo_config.get("conda", {}) + disallowed_keys = conda_config_vars.keys() - cf_allowed_condarc_keys + if disallowed_keys: + raise RuntimeError(f"""conda-forge.yml's "conda" key had the following disallowed values: {", ".join(disallowed_keys)}""") + for k, v in conda_config_vars.items(): + if v is not None: + call([ + "conda", "config", "--env", "--set", + f"{k}", str(v) + ]) + conda_build_config_vars = repo_config.get("conda_build", {}) for k, v in cf_conda_build_defaults.items(): if k not in conda_build_config_vars: