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

Only use spec names with conda update, mamba and uninstalls are fine #1774

Merged
merged 6 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 7 additions & 4 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2036,10 +2036,13 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None):
config["remote_ci_setup"] = _santize_remote_ci_setup(
config["remote_ci_setup"]
)
config["remote_ci_setup_names"] = [
MatchSpec(pkg.strip('"').strip("'")).name
for pkg in config["remote_ci_setup"]
]
if config["conda_install_tool"] == "conda":
config["remote_ci_setup_update"] = [
MatchSpec(pkg.strip('"').strip("'")).name
for pkg in config["remote_ci_setup"]
]
else:
config["remote_ci_setup_update"] = config["remote_ci_setup"]

# Older conda-smithy versions supported this with only one
# entry. To avoid breakage, we are converting single elements
Expand Down
6 changes: 3 additions & 3 deletions conda_smithy/templates/build_steps.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1

{{ conda_install_tool }} install --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }}
{%- if conda_build_tool_deps != "" or conda_install_tool_deps != "" %}
{%- if conda_install_tool == "mamba" and (conda_build_tool_deps != "" or conda_install_tool_deps != "") %}
{{ conda_install_tool }} update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_names) }}
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_update) }}
{%- endif %}
{% if local_ci_setup %}
conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup_names)}}
conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup)}}
pip install --no-deps ${RECIPE_ROOT}/.
{%- endif %}
# set up the condarc
Expand Down
6 changes: 3 additions & 3 deletions conda_smithy/templates/run_osx_build.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1

{{ conda_install_tool }} install --update-specs --quiet --yes --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }}
{%- if conda_build_tool_deps != "" or conda_install_tool_deps != "" %}
{%- if conda_install_tool == "mamba" and (conda_build_tool_deps != "" or conda_install_tool_deps != "") %}
{{ conda_install_tool }} update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_names) }}
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_update) }}
{%- endif %}

{% if local_ci_setup %}
conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup_names) }}
conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }}
pip install --no-deps {{ recipe_dir }}/.
{%- endif %}

Expand Down
2 changes: 1 addition & 1 deletion conda_smithy/templates/run_win_build.bat.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if !errorlevel! neq 0 exit /b !errorlevel!

{%- if local_ci_setup %}
echo Overriding conda-forge-ci-setup with local version
conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup_names) }}
conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }}
if !errorlevel! neq 0 exit /b !errorlevel!
pip install --no-deps ".\{{ recipe_dir }}\."
if !errorlevel! neq 0 exit /b !errorlevel!
Expand Down
23 changes: 23 additions & 0 deletions news/1774-update-names
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Do not strip version constraints for ``mamba update``. (#1773 via #1774)

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
27 changes: 25 additions & 2 deletions tests/test_configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,35 @@ def test_remote_ci_setup(config_yaml):
),
)
cfg = load_forge_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("remote_ci_setup: ['conda-forge-ci-setup=3', 'py-lief<0.12']")
fp.write(
"remote_ci_setup: ['conda-forge-ci-setup=3', 'py-lief<0.12']\n"
)
fp.write("conda_install_tool: conda\n")
cfg = load_forge_config()
# pylief was quoted due to <
assert cfg["remote_ci_setup"] == [
"conda-forge-ci-setup=3",
'"py-lief<0.12"',
]
assert cfg["remote_ci_setup_names"] == ["conda-forge-ci-setup", "py-lief"]
assert cfg["remote_ci_setup_update"] == ["conda-forge-ci-setup", "py-lief"]

with open(os.path.join(config_yaml, "conda-forge.yml"), "w") as fp:
fp.write(unmodified + "\n")
fp.write(
"remote_ci_setup: ['conda-forge-ci-setup=3', 'py-lief<0.12']\n"
)
fp.write("conda_install_tool: mamba\n")
cfg = load_forge_config()
# with conda_install_tool = mamba, we don't strip constraints
assert (
cfg["remote_ci_setup"]
== cfg["remote_ci_setup_update"]
== [
"conda-forge-ci-setup=3",
'"py-lief<0.12"',
]
)