From 2c3afbf5060637afa555bf5fa0248c3ea15595d5 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 26 Apr 2023 12:22:50 +0200 Subject: [PATCH 1/8] refactor build_with_mambabuild bool with conda_build_tool choice --- conda_smithy/configure_feedstock.py | 21 ++++++++++- .../templates/azure-pipelines-win.yml.tmpl | 18 +++++++--- conda_smithy/templates/build_steps.sh.tmpl | 26 +++++++++----- conda_smithy/templates/github-actions.tmpl | 19 +++++++--- conda_smithy/templates/run_osx_build.sh.tmpl | 26 +++++++++----- tests/test_configure_feedstock.py | 35 +++++++++++++++++++ 6 files changed, 116 insertions(+), 29 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 00245a1c7..3728e4f8a 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -1816,7 +1816,7 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): "conda_forge_output_validation": False, "private_upload": False, "secrets": [], - "build_with_mambabuild": True, + "conda_build_tool": "mambabuild", # feedstock checkout git clone depth, None means keep default, 0 means no limit "clone_depth": None, # Specific channel for package can be given with @@ -1902,6 +1902,25 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): f"{target_platforms}" ) + if "build_with_mambabuild" in file_config and "conda_build_tool" not in file_config: + warnings.warn( + "build_with_mambabuild is deprecated, use conda_build_tool instead", + DeprecationWarning, + ) + config["conda_build_tool"] = ( + "mambabuild" if config["build_with_mambabuild"] else "conda-build" + ) + valid_build_tools = ( + "mambabuild", # will run 'conda mambabuild', as provided by boa + "conda-build", # will run vanilla conda-build, with system configured / default solver + "conda-build+conda-libmamba-solver", # will run vanilla conda-build, with libmamba solver + "conda-build+classic", # will run vanilla conda-build, with the classic solver + ) + assert config["conda_build_tool"] in valid_build_tools, ( + f"Invalid conda_build_tool: {config['conda_build_tool']}. " + f"Valid values are: {valid_build_tools}." + ) + config["secrets"] = sorted(set(config["secrets"] + ["BINSTAR_TOKEN"])) if config["test_on_native_only"]: diff --git a/conda_smithy/templates/azure-pipelines-win.yml.tmpl b/conda_smithy/templates/azure-pipelines-win.yml.tmpl index 81fdc70d1..3d4c463dd 100644 --- a/conda_smithy/templates/azure-pipelines-win.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines-win.yml.tmpl @@ -16,10 +16,12 @@ jobs: displayName: "Install Chocolatey Package: {{ choco_pkg }}" {% endfor %} -{%- if build_with_mambabuild %} -{%- set BOA="boa " %} +{%- if conda_build_tool == "mambabuild" %} +{%- set conda_build_tool_deps="boa " %} +{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} +{%- set conda_build_tool_deps="conda-libmamba-solver " %} {%- else %} -{%- set BOA="" %} +{%- set conda_build_tool_deps="" %} {%- endif %} - task: PythonScript@0 displayName: 'Download Miniforge' @@ -40,7 +42,7 @@ jobs: - script: | call activate base - mamba.exe install "python=3.10" conda-build conda pip {{ BOA }}{{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes + mamba.exe install "python=3.10" conda-build conda pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes displayName: Install conda-build - script: set PYTHONUNBUFFERED=1 @@ -70,8 +72,14 @@ jobs: if EXIST LICENSE.txt ( copy LICENSE.txt "{{ recipe_dir }}\\recipe-scripts-license.txt" ) - {%- if build_with_mambabuild %} + {%- if conda_build_tool == "mambabuild" %} conda.exe mambabuild "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml --suppress-variables + {%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} + set "CONDA_SOLVER=libmamba" + conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml --suppress-variables + {%- elif conda_build_tool == "conda-build+classic" %} + set "CONDA_SOLVER=classic" + conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml --suppress-variables {%- else %} conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml --suppress-variables {%- endif %} diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 98213b65b..be93eb7e9 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -30,21 +30,29 @@ pkgs_dirs: - /opt/conda/pkgs CONDARC -{% if build_with_mambabuild %} +{% if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set BOA="boa " %} -{%- set BUILD_CMD="mambabuild" %} +{%- set conda_build_tool_deps="boa " %} +{%- set BUILD_CMD="conda mambabuild" %} +{% elif conda_build_tool == "conda-build+conda-libmamba-solver" %} +{%- set CONDA_INSTALL_CMD="mamba" %} +{%- set conda_build_tool_deps="conda-libmamba-solver " %} +{%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} +{% elif conda_build_tool == "conda-build+classic" %} +{%- set CONDA_INSTALL_CMD="mamba" %} +{%- set conda_build_tool_deps="" %} +{%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set BOA="" %} -{%- set BUILD_CMD="build" %} +{%- set conda_build_tool_deps="" %} +{%- set BUILD_CMD="conda build" %} {%- endif %} {{ CONDA_INSTALL_CMD }} install --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ BOA }}{{ " ".join(remote_ci_setup) }} -{%- if build_with_mambabuild %} + conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} +{%- if conda_build_tool_deps != "" %} {{ CONDA_INSTALL_CMD }} update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ BOA }}{{ " ".join(remote_ci_setup) }} + conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} {%- endif %} {% if local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} @@ -88,7 +96,7 @@ if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then # Drop into an interactive shell /bin/bash else - conda {{ BUILD_CMD }} "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + {{ BUILD_CMD }} "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" diff --git a/conda_smithy/templates/github-actions.tmpl b/conda_smithy/templates/github-actions.tmpl index 951a8fc45..fcd4f6c92 100644 --- a/conda_smithy/templates/github-actions.tmpl +++ b/conda_smithy/templates/github-actions.tmpl @@ -142,16 +142,19 @@ jobs: miniforge-variant: Mambaforge if: matrix.os == 'windows' -{%- if build_with_mambabuild %} -{%- set BOA="boa " %} +{%- if conda_build_tool == "mambabuild" %} +{%- set conda_build_tool_deps="boa " %} {%- else %} -{%- set BOA="" %} +{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} +{%- set conda_build_tool_deps="conda-libmamba-solver " %} +{%- else %} +{%- set conda_build_tool_deps="" %} {%- endif %} - name: Build on windows shell: cmd run: | call activate base - mamba.exe install -c conda-forge 'python=3.9' conda-build conda pip {{ BOA }}{{ " ".join(remote_ci_setup) }} + mamba.exe install -c conda-forge 'python=3.9' conda-build conda pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} if errorlevel 1 exit 1 {%- if local_ci_setup %} conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }}" @@ -168,8 +171,14 @@ jobs: if EXIST LICENSE.txt ( copy LICENSE.txt "{{ recipe_dir }}\\recipe-scripts-license.txt" ) - {%- if build_with_mambabuild %} + {%- if conda_build_tool == "mambabuild" %} conda.exe mambabuild "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml + {%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} + set "CONDA_SOLVER=libmamba" + conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml + {%- elif conda_build_tool == "conda-build+classic" %} + set "CONDA_SOLVER=classic" + conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml {%- else %} conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml {%- endif %} diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index 917f96cc0..a8aac33f6 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -19,23 +19,31 @@ bash $MINIFORGE_FILE -b -p ${MINIFORGE_HOME} ( endgroup "Installing a fresh version of Miniforge" ) 2> /dev/null ( startgroup "Configuring conda" ) 2> /dev/null -{% if build_with_mambabuild %} +{% if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set BOA="boa " %} -{%- set BUILD_CMD="mambabuild" %} +{%- set conda_build_tool_deps="boa " %} +{%- set BUILD_CMD="conda mambabuild" %} +{% elif conda_build_tool == "conda-build+conda-libmamba-solver" %} +{%- set CONDA_INSTALL_CMD="mamba" %} +{%- set conda_build_tool_deps="conda-libmamba-solver " %} +{%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} +{% elif conda_build_tool == "conda-build+classic" %} +{%- set CONDA_INSTALL_CMD="mamba" %} +{%- set conda_build_tool_deps="" %} +{%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set BOA="" %} -{%- set BUILD_CMD="build" %} +{%- set conda_build_tool_deps="" %} +{%- set BUILD_CMD="conda build" %} {%- endif %} source ${MINIFORGE_HOME}/etc/profile.d/conda.sh conda activate base {{ CONDA_INSTALL_CMD }} install --update-specs --quiet --yes --channel conda-forge \ - conda-build pip {{ BOA }}{{ " ".join(remote_ci_setup) }} -{%- if build_with_mambabuild %} + conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} +{%- if conda_build_tool_deps != "" %} {{ CONDA_INSTALL_CMD }} update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ BOA }}{{ " ".join(remote_ci_setup) }} + conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} {%- endif %} {% if local_ci_setup %} @@ -88,7 +96,7 @@ else EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --no-test" fi {% endif %} - conda {{ BUILD_CMD }} ./{{ recipe_dir }} -m ./.ci_support/${CONFIG}.yaml \ + {{ BUILD_CMD }} ./{{ recipe_dir }} -m ./.ci_support/${CONFIG}.yaml \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file ./.ci_support/clobber_${CONFIG}.yaml diff --git a/tests/test_configure_feedstock.py b/tests/test_configure_feedstock.py index 2ffbe589a..a3bb8460f 100644 --- a/tests/test_configure_feedstock.py +++ b/tests/test_configure_feedstock.py @@ -863,3 +863,38 @@ def test_cuda_enabled_render(cuda_enabled_recipe, jinja_env): else: if "CF_CUDA_ENABLED" in os.environ: del os.environ["CF_CUDA_ENABLED"] + + +def test_conda_build_tools(config_yaml): + load_forge_config = lambda: cnfgr_fdstk._load_forge_config( # noqa + config_yaml, + exclusive_config_file=os.path.join( + config_yaml, "recipe", "default_config.yaml" + ), + ) + + cfg = load_forge_config() + assert "build_with_mambabuild" not in cfg # superseded by conda_build_tool=mambabuild + assert cfg["conda_build_tool"] == "mambabuild" # current default + + # legacy compatibility config + with open(os.path.join(config_yaml, "conda-forge.yml")) as fp: + unmodified = fp.read() + with open(os.path.join(config_yaml, "conda-forge.yml"), "a+") as fp: + fp.write("build_with_mambabuild: true") + with pytest.deprecated_call(match="build_with_mambabuild is deprecated"): + assert load_forge_config()["conda_build_tool"] == "mambabuild" + + with open(os.path.join(config_yaml, "conda-forge.yml"), "w") as fp: + fp.write(unmodified) + fp.write("build_with_mambabuild: false") + + with pytest.deprecated_call(match="build_with_mambabuild is deprecated"): + assert load_forge_config()["conda_build_tool"] == "conda-build" + + with open(os.path.join(config_yaml, "conda-forge.yml"), "w") as fp: + fp.write(unmodified) + fp.write("conda_build_tool: does-not-exist") + + with pytest.raises(AssertionError): + assert load_forge_config() \ No newline at end of file From d6577ed4952128c1e22735b04cf6ccfa19f47977 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 26 Apr 2023 12:35:59 +0200 Subject: [PATCH 2/8] remove extra else --- conda_smithy/templates/github-actions.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/conda_smithy/templates/github-actions.tmpl b/conda_smithy/templates/github-actions.tmpl index fcd4f6c92..6a700cb6c 100644 --- a/conda_smithy/templates/github-actions.tmpl +++ b/conda_smithy/templates/github-actions.tmpl @@ -144,7 +144,6 @@ jobs: {%- if conda_build_tool == "mambabuild" %} {%- set conda_build_tool_deps="boa " %} -{%- else %} {%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} {%- set conda_build_tool_deps="conda-libmamba-solver " %} {%- else %} From 26839059993d8521a414087142a6682ba13ca2bd Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 26 Apr 2023 12:36:06 +0200 Subject: [PATCH 3/8] pre-commit --- conda_smithy/configure_feedstock.py | 7 +++++-- tests/test_configure_feedstock.py | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 3728e4f8a..99fc9129e 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -1902,7 +1902,10 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): f"{target_platforms}" ) - if "build_with_mambabuild" in file_config and "conda_build_tool" not in file_config: + if ( + "build_with_mambabuild" in file_config + and "conda_build_tool" not in file_config + ): warnings.warn( "build_with_mambabuild is deprecated, use conda_build_tool instead", DeprecationWarning, @@ -1911,7 +1914,7 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): "mambabuild" if config["build_with_mambabuild"] else "conda-build" ) valid_build_tools = ( - "mambabuild", # will run 'conda mambabuild', as provided by boa + "mambabuild", # will run 'conda mambabuild', as provided by boa "conda-build", # will run vanilla conda-build, with system configured / default solver "conda-build+conda-libmamba-solver", # will run vanilla conda-build, with libmamba solver "conda-build+classic", # will run vanilla conda-build, with the classic solver diff --git a/tests/test_configure_feedstock.py b/tests/test_configure_feedstock.py index a3bb8460f..a5d3b2815 100644 --- a/tests/test_configure_feedstock.py +++ b/tests/test_configure_feedstock.py @@ -874,7 +874,9 @@ def test_conda_build_tools(config_yaml): ) cfg = load_forge_config() - assert "build_with_mambabuild" not in cfg # superseded by conda_build_tool=mambabuild + assert ( + "build_with_mambabuild" not in cfg + ) # superseded by conda_build_tool=mambabuild assert cfg["conda_build_tool"] == "mambabuild" # current default # legacy compatibility config @@ -884,17 +886,17 @@ def test_conda_build_tools(config_yaml): fp.write("build_with_mambabuild: true") with pytest.deprecated_call(match="build_with_mambabuild is deprecated"): assert load_forge_config()["conda_build_tool"] == "mambabuild" - + with open(os.path.join(config_yaml, "conda-forge.yml"), "w") as fp: fp.write(unmodified) fp.write("build_with_mambabuild: false") - + with pytest.deprecated_call(match="build_with_mambabuild is deprecated"): assert load_forge_config()["conda_build_tool"] == "conda-build" with open(os.path.join(config_yaml, "conda-forge.yml"), "w") as fp: fp.write(unmodified) fp.write("conda_build_tool: does-not-exist") - + with pytest.raises(AssertionError): - assert load_forge_config() \ No newline at end of file + assert load_forge_config() From 8d187b6b20ab64906b6767991ce6c693adaf92fa Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 4 Aug 2023 17:58:50 +0200 Subject: [PATCH 4/8] add news --- news/1732-conda-build-options | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 news/1732-conda-build-options diff --git a/news/1732-conda-build-options b/news/1732-conda-build-options new file mode 100644 index 000000000..3282ff55c --- /dev/null +++ b/news/1732-conda-build-options @@ -0,0 +1,24 @@ +**Added:** + +* ``conda_build_tool`` setting with four different options: ``conda-build``, ``mambabuild`` (default), + ``conda-build+conda-libmamba-solver`` and ``conda-build+classic``. - #1732 + +**Changed:** + +* + +**Deprecated:** + +* ``build_with_mambabuild`` boolean option is deprecated. Use ``conda_build_tool: mambabuild`` instead. - #1732 + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 01db2d64e1d44770319ef5d4ce1cf447c0758597 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 7 Aug 2023 09:46:12 +0200 Subject: [PATCH 5/8] set "conda_build_tool_deps" in configure_feedstock.py --- conda_smithy/configure_feedstock.py | 12 ++++++++++++ conda_smithy/templates/azure-pipelines-win.yml.tmpl | 7 ------- conda_smithy/templates/build_steps.sh.tmpl | 4 ---- conda_smithy/templates/github-actions.tmpl | 7 ------- conda_smithy/templates/run_osx_build.sh.tmpl | 4 ---- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 4d043792b..5b6b62d77 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -1820,6 +1820,7 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): "private_upload": False, "secrets": [], "conda_build_tool": "mambabuild", + "conda_build_tool_deps": "boa", # feedstock checkout git clone depth, None means keep default, 0 means no limit "clone_depth": None, # Specific channel for package can be given with @@ -1916,6 +1917,11 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): config["conda_build_tool"] = ( "mambabuild" if config["build_with_mambabuild"] else "conda-build" ) + if file_config.get("conda_build_tool_deps"): + raise ValueError( + "Cannot set 'conda_build_tool_deps' directly. " + "Use 'conda_build_tool' instead." + ) valid_build_tools = ( "mambabuild", # will run 'conda mambabuild', as provided by boa "conda-build", # will run vanilla conda-build, with system configured / default solver @@ -1926,6 +1932,12 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): f"Invalid conda_build_tool: {config['conda_build_tool']}. " f"Valid values are: {valid_build_tools}." ) + if config["conda_build_tool"] == "mambabuild": + config["conda_build_tool_deps"] = "boa" + elif config["conda_build_tool"] == "conda-build+conda-libmamba-solver": + config["conda_build_tool_deps"] = "conda-libmamba-solver" + elif config["conda_build_tool"] in ("conda-build", "conda-build+classic"): + config["conda_build_tool_deps"] = "" config["secrets"] = sorted(set(config["secrets"] + ["BINSTAR_TOKEN"])) diff --git a/conda_smithy/templates/azure-pipelines-win.yml.tmpl b/conda_smithy/templates/azure-pipelines-win.yml.tmpl index adf439601..acfbe564d 100644 --- a/conda_smithy/templates/azure-pipelines-win.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines-win.yml.tmpl @@ -16,13 +16,6 @@ jobs: displayName: "Install Chocolatey Package: {{ choco_pkg }}" {% endfor %} -{%- if conda_build_tool == "mambabuild" %} -{%- set conda_build_tool_deps="boa " %} -{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} -{%- set conda_build_tool_deps="conda-libmamba-solver " %} -{%- else %} -{%- set conda_build_tool_deps="" %} -{%- endif %} - task: PythonScript@0 displayName: 'Download Miniforge' inputs: diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index be93eb7e9..1d58ece13 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -32,19 +32,15 @@ pkgs_dirs: CONDARC {% if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="boa " %} {%- set BUILD_CMD="conda mambabuild" %} {% elif conda_build_tool == "conda-build+conda-libmamba-solver" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="conda-libmamba-solver " %} {%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} {% elif conda_build_tool == "conda-build+classic" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="" %} {%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="" %} {%- set BUILD_CMD="conda build" %} {%- endif %} diff --git a/conda_smithy/templates/github-actions.tmpl b/conda_smithy/templates/github-actions.tmpl index 1bcb8f48c..14f126713 100644 --- a/conda_smithy/templates/github-actions.tmpl +++ b/conda_smithy/templates/github-actions.tmpl @@ -172,13 +172,6 @@ jobs: miniforge-variant: Mambaforge if: matrix.os == 'windows' -{%- if conda_build_tool == "mambabuild" %} -{%- set conda_build_tool_deps="boa " %} -{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} -{%- set conda_build_tool_deps="conda-libmamba-solver " %} -{%- else %} -{%- set conda_build_tool_deps="" %} -{%- endif %} - name: Build on windows shell: cmd run: | diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index a8aac33f6..e834a98a9 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -21,19 +21,15 @@ bash $MINIFORGE_FILE -b -p ${MINIFORGE_HOME} ( startgroup "Configuring conda" ) 2> /dev/null {% if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="boa " %} {%- set BUILD_CMD="conda mambabuild" %} {% elif conda_build_tool == "conda-build+conda-libmamba-solver" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="conda-libmamba-solver " %} {%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} {% elif conda_build_tool == "conda-build+classic" %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="" %} {%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} {%- set CONDA_INSTALL_CMD="mamba" %} -{%- set conda_build_tool_deps="" %} {%- set BUILD_CMD="conda build" %} {%- endif %} source ${MINIFORGE_HOME}/etc/profile.d/conda.sh From 86b56d404727b2cf9fd41fb4eb02c0defa9c835d Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 7 Aug 2023 10:07:00 +0200 Subject: [PATCH 6/8] Add a space --- conda_smithy/templates/azure-pipelines-win.yml.tmpl | 2 +- conda_smithy/templates/build_steps.sh.tmpl | 4 ++-- conda_smithy/templates/github-actions.tmpl | 2 +- conda_smithy/templates/run_osx_build.sh.tmpl | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conda_smithy/templates/azure-pipelines-win.yml.tmpl b/conda_smithy/templates/azure-pipelines-win.yml.tmpl index acfbe564d..4ac2a5224 100644 --- a/conda_smithy/templates/azure-pipelines-win.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines-win.yml.tmpl @@ -35,7 +35,7 @@ jobs: - script: | call activate base - mamba.exe install "python=3.10" conda-build conda pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes + mamba.exe install "python=3.10" conda-build conda pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes displayName: Install conda-build - script: set PYTHONUNBUFFERED=1 diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 1d58ece13..c4d71f777 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -45,10 +45,10 @@ CONDARC {%- endif %} {{ CONDA_INSTALL_CMD }} install --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} + conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- if conda_build_tool_deps != "" %} {{ CONDA_INSTALL_CMD }} update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} + conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- endif %} {% if local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} diff --git a/conda_smithy/templates/github-actions.tmpl b/conda_smithy/templates/github-actions.tmpl index 14f126713..755a82a78 100644 --- a/conda_smithy/templates/github-actions.tmpl +++ b/conda_smithy/templates/github-actions.tmpl @@ -176,7 +176,7 @@ jobs: shell: cmd run: | call activate base - mamba.exe install -c conda-forge 'python=3.9' conda-build conda pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} + mamba.exe install -c conda-forge 'python=3.9' conda-build conda pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} if errorlevel 1 exit 1 {%- if local_ci_setup %} conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }}" diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index e834a98a9..9cf69f3f3 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -36,10 +36,10 @@ source ${MINIFORGE_HOME}/etc/profile.d/conda.sh conda activate base {{ CONDA_INSTALL_CMD }} install --update-specs --quiet --yes --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} + conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- if conda_build_tool_deps != "" %} {{ CONDA_INSTALL_CMD }} update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }}{{ " ".join(remote_ci_setup) }} + conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- endif %} {% if local_ci_setup %} From e0193af1d5d3bad76acbacb5765f41ce8969483a Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 7 Aug 2023 10:09:35 +0200 Subject: [PATCH 7/8] check vertical whitespace --- conda_smithy/templates/build_steps.sh.tmpl | 6 +++--- conda_smithy/templates/run_osx_build.sh.tmpl | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index c4d71f777..8ae28ccb2 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -30,13 +30,13 @@ pkgs_dirs: - /opt/conda/pkgs CONDARC -{% if conda_build_tool == "mambabuild" %} +{%- if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="conda mambabuild" %} -{% elif conda_build_tool == "conda-build+conda-libmamba-solver" %} +{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} -{% elif conda_build_tool == "conda-build+classic" %} +{%- elif conda_build_tool == "conda-build+classic" %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index 9cf69f3f3..116f4954f 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -19,19 +19,20 @@ bash $MINIFORGE_FILE -b -p ${MINIFORGE_HOME} ( endgroup "Installing a fresh version of Miniforge" ) 2> /dev/null ( startgroup "Configuring conda" ) 2> /dev/null -{% if conda_build_tool == "mambabuild" %} +{%- if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="conda mambabuild" %} -{% elif conda_build_tool == "conda-build+conda-libmamba-solver" %} +{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} -{% elif conda_build_tool == "conda-build+classic" %} +{%- elif conda_build_tool == "conda-build+classic" %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} {%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="conda build" %} {%- endif %} + source ${MINIFORGE_HOME}/etc/profile.d/conda.sh conda activate base From 22a1ae6a7b3305c389a3669c535377ddcc32a8e4 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 31 Aug 2023 20:37:12 +0200 Subject: [PATCH 8/8] conda-build dependency should be explicitly mentioned in config (not hardcoded) --- conda_smithy/configure_feedstock.py | 6 +++--- conda_smithy/templates/azure-pipelines-win.yml.tmpl | 2 +- conda_smithy/templates/build_steps.sh.tmpl | 9 +++------ conda_smithy/templates/github-actions.tmpl | 2 +- conda_smithy/templates/run_osx_build.sh.tmpl | 9 +++------ 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 5b6b62d77..43dce2591 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -1935,9 +1935,9 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): if config["conda_build_tool"] == "mambabuild": config["conda_build_tool_deps"] = "boa" elif config["conda_build_tool"] == "conda-build+conda-libmamba-solver": - config["conda_build_tool_deps"] = "conda-libmamba-solver" - elif config["conda_build_tool"] in ("conda-build", "conda-build+classic"): - config["conda_build_tool_deps"] = "" + config["conda_build_tool_deps"] = "conda-build conda-libmamba-solver" + else: + config["conda_build_tool_deps"] = "conda-build" config["secrets"] = sorted(set(config["secrets"] + ["BINSTAR_TOKEN"])) diff --git a/conda_smithy/templates/azure-pipelines-win.yml.tmpl b/conda_smithy/templates/azure-pipelines-win.yml.tmpl index 4ac2a5224..08f0b45d0 100644 --- a/conda_smithy/templates/azure-pipelines-win.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines-win.yml.tmpl @@ -35,7 +35,7 @@ jobs: - script: | call activate base - mamba.exe install "python=3.10" conda-build conda pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes + mamba.exe install "python=3.10" conda pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes displayName: Install conda-build - script: set PYTHONUNBUFFERED=1 diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 8ae28ccb2..ec7c0eab2 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -30,25 +30,22 @@ pkgs_dirs: - /opt/conda/pkgs CONDARC -{%- if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} +{%- if conda_build_tool == "mambabuild" %} {%- set BUILD_CMD="conda mambabuild" %} {%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} -{%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} {%- elif conda_build_tool == "conda-build+classic" %} -{%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} -{%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="conda build" %} {%- endif %} {{ CONDA_INSTALL_CMD }} install --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} + pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- if conda_build_tool_deps != "" %} {{ CONDA_INSTALL_CMD }} update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} + pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- endif %} {% if local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} diff --git a/conda_smithy/templates/github-actions.tmpl b/conda_smithy/templates/github-actions.tmpl index 755a82a78..d3b324325 100644 --- a/conda_smithy/templates/github-actions.tmpl +++ b/conda_smithy/templates/github-actions.tmpl @@ -176,7 +176,7 @@ jobs: shell: cmd run: | call activate base - mamba.exe install -c conda-forge 'python=3.9' conda-build conda pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} + mamba.exe install -c conda-forge 'python=3.9' conda pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} if errorlevel 1 exit 1 {%- if local_ci_setup %} conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }}" diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index 116f4954f..ebf6e0898 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -19,17 +19,14 @@ bash $MINIFORGE_FILE -b -p ${MINIFORGE_HOME} ( endgroup "Installing a fresh version of Miniforge" ) 2> /dev/null ( startgroup "Configuring conda" ) 2> /dev/null -{%- if conda_build_tool == "mambabuild" %} {%- set CONDA_INSTALL_CMD="mamba" %} +{%- if conda_build_tool == "mambabuild" %} {%- set BUILD_CMD="conda mambabuild" %} {%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %} -{%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=libmamba conda build" %} {%- elif conda_build_tool == "conda-build+classic" %} -{%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="CONDA_SOLVER=classic conda build" %} {%- else %} -{%- set CONDA_INSTALL_CMD="mamba" %} {%- set BUILD_CMD="conda build" %} {%- endif %} @@ -37,10 +34,10 @@ source ${MINIFORGE_HOME}/etc/profile.d/conda.sh conda activate base {{ CONDA_INSTALL_CMD }} install --update-specs --quiet --yes --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} + pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- if conda_build_tool_deps != "" %} {{ CONDA_INSTALL_CMD }} update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} + pip {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- endif %} {% if local_ci_setup %}