Skip to content

Commit

Permalink
fix: add warning when using defaults (#3434)
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Co-authored-by: Johan Mabille <johan.mabille@gmail.com>
Co-authored-by: Sylvain Corlay <sylvain.corlay@gmail.com>
  • Loading branch information
5 people authored Sep 12, 2024
1 parent 12fef58 commit a261cd4
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ jobs:
with:
repository: conda-forge/micromamba-feedstock
path: micromamba-feedstock
- name: Disable output validation
if: ${{ matrix.platform == 'osx' }}
run: |
cd micromamba-feedstock/
sed -i '' '/conda_forge_output_validation/d' conda-forge.yml
- name: Pin libcurl
if: ${{ matrix.platform == 'osx' }}
run: |
cd micromamba-feedstock/
sed -i '' 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml
sed -i '' 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml
- name: Pin libcurl
if: ${{ matrix.platform == 'linux' }}
run: |
cd micromamba-feedstock/
sed -i 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml
sed -i 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml
- name: Checkout mamba branch
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion dev/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- cpp-expected
- fmt
- libarchive
- libcurl >=7.86
- libcurl >=7.86,<8.10
- libsodium
- libsolv >=0.7.18
- nlohmann_json
Expand Down
4 changes: 2 additions & 2 deletions dev/environment-micromamba-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ dependencies:
- yaml-cpp-static >=0.8.0
- reproc-static >=14.2.4.post0
- reproc-cpp-static >=14.2.4.post0
- libcurl >=8.4.0
- libcurl-static >=8.4.0
- libcurl >=8.4.0,<8.10
- libcurl-static >=8.4.0,<8.10
- xz-static
- libssh2-static
- libarchive-minimal-static
Expand Down
2 changes: 2 additions & 0 deletions libmamba/include/mamba/core/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ namespace mamba
bool always_softlink = false;
bool register_envs = true;

bool show_anaconda_channel_warnings = true;

// solver options
solver::Request::Flags solver_flags = {};

Expand Down
10 changes: 10 additions & 0 deletions libmamba/src/api/channel_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ namespace mamba
{
for (const auto& platform : channel.platforms())
{
auto show_warning = ctx.show_anaconda_channel_warnings;
auto channel_name = channel.platform_url(platform).host();
if (channel_name == "repo.anaconda.com" && show_warning)
{
LOG_WARNING << "'" << channel_name
<< "', a commercial channel hosted by Anaconda.com, is used.\n";
LOG_WARNING << "Please make sure you understand Anaconda Terms of Services.\n";
LOG_WARNING << "See: https://legal.anaconda.com/policies/en/";
}

auto sdires = SubdirData::create(
ctx,
channel_context,
Expand Down
6 changes: 6 additions & 0 deletions libmamba/src/api/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,12 @@ namespace mamba
!WARNING: Using this option can result in corruption of long-lived
environments due to broken links (deleted cache).)")));

insert(Configurable("show_anaconda_channel_warnings", &m_context.show_anaconda_channel_warnings)
.group("Extract, Link & Install")
.set_rc_configurable()
.set_env_var_names({ "MAMBA_SHOW_ANACONDA_CHANNEL_WARNINGS" })
.description("Show the warning when the Anaconda official channels are used"));

insert(Configurable("shortcuts", &m_context.shortcuts)
.group("Extract, Link & Install")
.set_rc_configurable()
Expand Down
1 change: 1 addition & 0 deletions libmambapy/src/libmambapy/bindings/legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ bind_submodule_impl(pybind11::module_ m)
.def_readwrite("local_repodata_ttl", &Context::local_repodata_ttl)
.def_readwrite("use_index_cache", &Context::use_index_cache)
.def_readwrite("always_yes", &Context::always_yes)
.def_readwrite("show_anaconda_channel_warnings", &Context::show_anaconda_channel_warnings)
.def_readwrite("dry_run", &Context::dry_run)
.def_readwrite("download_only", &Context::download_only)
.def_readwrite("add_pip_as_python_dependency", &Context::add_pip_as_python_dependency)
Expand Down

0 comments on commit a261cd4

Please sign in to comment.