From 670491d4a3de0f4db81b7dc840de07f5fa4eb6e4 Mon Sep 17 00:00:00 2001 From: Sandrine Pataut Date: Tue, 28 Jan 2025 17:48:04 +0100 Subject: [PATCH 01/14] add base subcommand --- libmamba/src/api/info.cpp | 205 +++++++++++++++++++++----------------- micromamba/src/info.cpp | 8 ++ 2 files changed, 123 insertions(+), 90 deletions(-) diff --git a/libmamba/src/api/info.cpp b/libmamba/src/api/info.cpp index 2b0ab6bd95..7195ce2abc 100644 --- a/libmamba/src/api/info.cpp +++ b/libmamba/src/api/info.cpp @@ -4,6 +4,8 @@ // // The full license is in the file LICENSE, distributed with this software. +#include + #include "mamba/api/configuration.hpp" #include "mamba/api/info.hpp" #include "mamba/core/channel_context.hpp" @@ -23,25 +25,13 @@ extern "C" namespace mamba { - void info(Configuration& config) - { - config.at("use_target_prefix_fallback").set_value(true); - config.at("use_default_prefix_fallback").set_value(true); - config.at("use_root_prefix_fallback").set_value(true); - config.at("target_prefix_checks") - .set_value( - MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX - ); - config.load(); - - auto channel_context = ChannelContext::make_conda_compatible(config.context()); - detail::print_info(config.context(), channel_context, config); - - config.operation_teardown(); - } - namespace detail { + struct list_options + { + bool base; + }; + void info_pretty_print( std::vector> items, const Context::OutputParams& params @@ -91,102 +81,137 @@ namespace mamba Console::instance().json_write(items_map); } - void print_info(Context& ctx, ChannelContext& channel_context, const Configuration& config) + void print_info( + Context& ctx, + ChannelContext& channel_context, + const Configuration& config, + list_options options + ) { assert(&ctx == &config.context()); - std::vector> items; - items.push_back({ "libmamba version", version() }); - - if (ctx.command_params.is_mamba_exe && !ctx.command_params.caller_version.empty()) + if (options.base) { - items.push_back({ - fmt::format("{} version", get_self_exe_path().stem().string()), - ctx.command_params.caller_version, - }); + std::cout << ctx.prefix_params.root_prefix.string() << std::endl; } + else + { + std::vector> items; - items.push_back({ "curl version", curl_version() }); - items.push_back({ "libarchive version", archive_version_details() }); + items.push_back({ "libmamba version", version() }); - items.push_back({ "envs directories", ctx.envs_dirs }); - items.push_back({ "package cache", ctx.pkgs_dirs }); + if (ctx.command_params.is_mamba_exe && !ctx.command_params.caller_version.empty()) + { + items.push_back({ + fmt::format("{} version", get_self_exe_path().stem().string()), + ctx.command_params.caller_version, + }); + } - std::string name, location; - if (!ctx.prefix_params.target_prefix.empty()) - { - name = env_name(ctx); - location = ctx.prefix_params.target_prefix.string(); - } - else - { - name = "None"; - location = "-"; - } + items.push_back({ "curl version", curl_version() }); + items.push_back({ "libarchive version", archive_version_details() }); - if (auto prefix = util::get_env("CONDA_PREFIX"); prefix == ctx.prefix_params.target_prefix) - { - name += " (active)"; - } - else if (fs::exists(ctx.prefix_params.target_prefix)) - { - if (!(fs::exists(ctx.prefix_params.target_prefix / "conda-meta") - || (ctx.prefix_params.target_prefix == ctx.prefix_params.root_prefix))) + items.push_back({ "envs directories", ctx.envs_dirs }); + items.push_back({ "package cache", ctx.pkgs_dirs }); + + std::string name, location; + if (!ctx.prefix_params.target_prefix.empty()) { - name += " (not env)"; + name = env_name(ctx); + location = ctx.prefix_params.target_prefix.string(); + } + else + { + name = "None"; + location = "-"; + } + + if (auto prefix = util::get_env("CONDA_PREFIX"); + prefix == ctx.prefix_params.target_prefix) + { + name += " (active)"; + } + else if (fs::exists(ctx.prefix_params.target_prefix)) + { + if (!(fs::exists(ctx.prefix_params.target_prefix / "conda-meta") + || (ctx.prefix_params.target_prefix == ctx.prefix_params.root_prefix))) + { + name += " (not env)"; + } + } + else + { + name += " (not found)"; } - } - else - { - name += " (not found)"; - } - items.push_back({ "environment", name }); - items.push_back({ "env location", location }); + items.push_back({ "environment", name }); + items.push_back({ "env location", location }); - // items.insert( { "shell level", { 1 } }); - items.push_back({ - "user config files", - { util::path_concat(util::user_home_dir(), ".mambarc") }, - }); + // items.insert( { "shell level", { 1 } }); + items.push_back({ + "user config files", + { util::path_concat(util::user_home_dir(), ".mambarc") }, + }); - std::vector sources; - for (auto s : config.valid_sources()) - { - sources.push_back(s.string()); - }; - items.push_back({ "populated config files", sources }); + std::vector sources; + for (auto s : config.valid_sources()) + { + sources.push_back(s.string()); + }; + items.push_back({ "populated config files", sources }); - std::vector virtual_pkgs; - for (auto pkg : get_virtual_packages(ctx.platform)) - { - virtual_pkgs.push_back(util::concat(pkg.name, "=", pkg.version, "=", pkg.build_string) - ); - } - items.push_back({ "virtual packages", virtual_pkgs }); + std::vector virtual_pkgs; + for (auto pkg : get_virtual_packages(ctx.platform)) + { + virtual_pkgs.push_back( + util::concat(pkg.name, "=", pkg.version, "=", pkg.build_string) + ); + } + items.push_back({ "virtual packages", virtual_pkgs }); - // Always append context channels - std::vector channel_urls; - using Credentials = specs::CondaURL::Credentials; - channel_urls.reserve(ctx.channels.size() * 2); // Lower bound * (platform + noarch) - for (const auto& loc : ctx.channels) - { - for (auto channel : channel_context.make_channel(loc)) + // Always append context channels + std::vector channel_urls; + using Credentials = specs::CondaURL::Credentials; + channel_urls.reserve(ctx.channels.size() * 2); // Lower bound * (platform + noarch) + for (const auto& loc : ctx.channels) { - for (auto url : channel.platform_urls()) + for (auto channel : channel_context.make_channel(loc)) { - channel_urls.push_back(std::move(url).str(Credentials::Remove)); + for (auto url : channel.platform_urls()) + { + channel_urls.push_back(std::move(url).str(Credentials::Remove)); + } } } - } - items.push_back({ "channels", channel_urls }); + items.push_back({ "channels", channel_urls }); - items.push_back({ "base environment", ctx.prefix_params.root_prefix.string() }); + items.push_back({ "base environment", ctx.prefix_params.root_prefix.string() }); - items.push_back({ "platform", ctx.platform }); + items.push_back({ "platform", ctx.platform }); - info_json_print(items); - info_pretty_print(items, ctx.output_params); + info_json_print(items); + info_pretty_print(items, ctx.output_params); + } } } // detail + + void info(Configuration& config) + { + config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); + config.at("target_prefix_checks") + .set_value( + MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX + ); + config.load(); + + detail::list_options options; + options.base = config.at("base").value(); + + auto channel_context = ChannelContext::make_conda_compatible(config.context()); + detail::print_info(config.context(), channel_context, config, std::move(options)); + + config.operation_teardown(); + } } // mamba diff --git a/micromamba/src/info.cpp b/micromamba/src/info.cpp index c992087984..3f931b16a7 100644 --- a/micromamba/src/info.cpp +++ b/micromamba/src/info.cpp @@ -4,11 +4,14 @@ // // The full license is in the file LICENSE, distributed with this software. +#include "mamba/api/configuration.hpp" #include "mamba/api/info.hpp" #include "mamba/core/context.hpp" #include "common_options.hpp" +using namespace mamba; + void init_info_parser(CLI::App* subcom, mamba::Configuration& config) { @@ -22,6 +25,11 @@ set_info_command(CLI::App* subcom, mamba::Configuration& config) init_info_parser(subcom, config); static bool print_licenses; + auto& base = config.insert( + Configurable("base", false).group("cli").description("Display base environment path.") + ); + subcom->add_flag("--base", base.get_cli_config(), base.description()); + subcom->add_flag("--licenses", print_licenses, "Print licenses"); subcom->callback( From 3abf53cec7f3ef49035f24188213ae1582c6a7fa Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 31 Jan 2025 11:15:55 +0200 Subject: [PATCH 02/14] maint: Factor handling of `GetModuleFileNameW` (#3785) Co-authored-by: Klaim --- libmamba/src/core/util_os.cpp | 74 ++++++++++++++++------------------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/libmamba/src/core/util_os.cpp b/libmamba/src/core/util_os.cpp index 4332dacc09..2758372074 100644 --- a/libmamba/src/core/util_os.cpp +++ b/libmamba/src/core/util_os.cpp @@ -47,29 +47,45 @@ static_assert(std::is_same_v); namespace mamba { - // Heavily inspired by https://github.com/gpakosz/whereami/ - // check their source to add support for other OS - fs::u8path get_self_exe_path() - { + #ifdef _WIN32 + fs::u8path get_hmodule_path(HMODULE hModule) + { std::wstring buffer(MAX_PATH, '\0'); - DWORD size = GetModuleFileNameW(NULL, (wchar_t*) buffer.c_str(), (DWORD) buffer.size()); - if (size == 0) - { - throw std::runtime_error("Could find location of the micromamba executable!"); - } - else if (size == buffer.size()) + DWORD new_size = MAX_PATH; + DWORD size = 0; + // There's unfortunately no way to know how much space is needed, + // so we just keep doubling the size of the buffer until the path fits. + while (true) { - DWORD new_size = size; - do + size = GetModuleFileNameW(hModule, buffer.data(), static_cast(buffer.size())); + if (size == 0) { - new_size *= 2; - buffer.reserve(new_size); - size = GetModuleFileNameW(NULL, (wchar_t*) buffer.c_str(), (DWORD) buffer.size()); - } while (new_size == size); + throw mamba::mamba_error( + "Could find the filename of the module handle. (GetModuleFileNameW failed)", + mamba_error_code::internal_failure + ); + } + if (size < new_size) + { + break; + } + + new_size *= 2; + buffer.resize(new_size); } - buffer.resize(buffer.find(L'\0')); + buffer.resize(size); return fs::absolute(buffer); + } +#endif + + // Heavily inspired by https://github.com/gpakosz/whereami/ + // check their source to add support for other OS + fs::u8path get_self_exe_path() + { +#ifdef _WIN32 + HMODULE hModule = NULL; // references file used to create the calling process + return get_hmodule_path(hModule); #elif defined(__APPLE__) uint32_t size = PATH_MAX; std::vector buffer(size); @@ -107,29 +123,7 @@ namespace mamba mamba_error_code::internal_failure ); } - std::wstring buffer(MAX_PATH, '\0'); - DWORD new_size = MAX_PATH; - DWORD size = 0; - while (true) - { - size = GetModuleFileNameW(hModule, buffer.data(), static_cast(buffer.size())); - if (size == 0) - { - throw mamba::mamba_error( - "Could find the filename of the libmamba's module handle. (GetModuleFileNameW failed)", - mamba_error_code::internal_failure - ); - } - if (size < new_size) - { - break; - } - - new_size *= 2; - buffer.resize(new_size); - } - buffer.resize(size); - return fs::absolute(buffer); + return get_hmodule_path(hModule); #else fs::u8path libmamba_path; Dl_info dl_info; From 2532535482819683013a28bbdb2cbde5659e84fa Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 31 Jan 2025 11:30:04 +0100 Subject: [PATCH 03/14] release libmamba 2.0.6.rc2, micromamba 2.0.6.rc2, libmambapy 2.0.6.rc2 --- CHANGELOG.md | 14 ++++++++++++++ libmamba/CHANGELOG.md | 12 ++++++++++++ libmamba/include/mamba/version.hpp | 4 ++-- libmambapy/CHANGELOG.md | 12 ++++++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 12 ++++++++++++ micromamba/src/version.hpp | 4 ++-- 7 files changed, 55 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b539b97183..bdb1e6844a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 2025.01.31 + +Release: 2.0.6.rc2 (libmamba, mamba, micromamba, libmambapy) + +Enhancements: + +- [all] Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 + +Bug fixes: + +- [all] Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- [all] Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- [all] Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 + # 2025.01.28 Release: 2.0.6.rc1 (libmamba, mamba, micromamba, libmambapy) diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 29ce0cd59b..5e8f813fb5 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,15 @@ +# libmamba 2.0.6.rc2 (January 31, 2025) + +Enhancements: + +- [all] Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 + +Bug fixes: + +- [all] Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- [all] Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- [all] Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 + # libmamba 2.0.6.rc1 (January 28, 2025) Enhancements: diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index db851b41e8..2f7e792904 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -15,10 +15,10 @@ #define LIBMAMBA_VERSION_PATCH 6 #define LIBMAMBA_VERSION_IS_PRERELEASE 1 #if LIBMAMBA_VERSION_IS_PRERELEASE == 1 -#define LIBMAMBA_VERSION_PRERELEASE_NAME "rc1" +#define LIBMAMBA_VERSION_PRERELEASE_NAME "rc2" #endif -#define LIBMAMBA_VERSION_STRING "2.0.6.rc1" +#define LIBMAMBA_VERSION_STRING "2.0.6.rc2" #define LIBMAMBA_VERSION \ (LIBMAMBA_VERSION_MAJOR * 10000 + LIBMAMBA_VERSION_MINOR * 100 + LIBMAMBA_VERSION_PATCH) diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index e08128f86c..efd89302d9 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,15 @@ +# libmambapy 2.0.6.rc2 (January 31, 2025) + +Enhancements: + +- [all] Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 + +Bug fixes: + +- [all] Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- [all] Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- [all] Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 + # libmambapy 2.0.6.rc1 (January 28, 2025) Enhancements: diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index e92fd842c0..653d6f11b7 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,5 +1,5 @@ version_info = ("2", "0", "6") -version_prerelease = "rc1" +version_prerelease = "rc2" __version__ = ".".join(map(str, version_info)) if version_prerelease != "": __version__ = f"{__version__}.{version_prerelease}" diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 982b3f6fb0..4014c89abe 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,15 @@ +# micromamba 2.0.6.rc2 (January 31, 2025) + +Enhancements: + +- [all] Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 + +Bug fixes: + +- [all] Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- [all] Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- [all] Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 + # micromamba 2.0.6.rc1 (January 28, 2025) Enhancements: diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index cca74ff7d1..172b281e24 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -15,10 +15,10 @@ #define UMAMBA_VERSION_PATCH 6 #define UMAMBA_VERSION_IS_PRERELEASE 1 #if UMAMBA_VERSION_IS_PRERELEASE == 1 -#define UMAMBA_VERSION_PRERELEASE_NAME "rc1" +#define UMAMBA_VERSION_PRERELEASE_NAME "rc2" #endif -#define UMAMBA_VERSION_STRING "2.0.6.rc1" +#define UMAMBA_VERSION_STRING "2.0.6.rc2" #define UMAMBA_VERSION \ (UMAMBA_VERSION_MAJOR * 10000 + UMAMBA_VERSION_MINOR * 100 + UMAMBA_VERSION_PATCH) From fd4116d939bbb9e55e886c8d547955e3bbc5c42e Mon Sep 17 00:00:00 2001 From: Sandrine Pataut Date: Fri, 31 Jan 2025 15:35:52 +0100 Subject: [PATCH 04/14] feat: add canonical flag to list command (#3777) --- libmamba/src/api/list.cpp | 31 ++++++++++++++++++++++++------- micromamba/src/list.cpp | 12 ++++++------ micromamba/tests/test_list.py | 24 +++++++++++++++++++----- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index caab6e3dad..cfc689c209 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -22,16 +22,17 @@ namespace mamba { struct list_options { - bool full_name; - bool no_pip; - bool reverse; - bool explicit_; - bool md5; + bool full_name = false; + bool no_pip = false; + bool reverse = false; + bool explicit_ = false; + bool md5 = false; + bool canonical = false; }; struct formatted_pkg { - std::string name, version, build, channel, url, md5; + std::string name, version, build, channel, url, md5, build_string, platform; }; bool compare_alphabetically(const formatted_pkg& a, const formatted_pkg& b) @@ -168,6 +169,7 @@ namespace mamba obj["channel"] = get_formatted_channel(pkg_info, channels.front()); obj["base_url"] = get_base_url(pkg_info, channels.front()); obj["url"] = pkg_info.package_url; + obj["md5"] = pkg_info.md5; obj["build_number"] = pkg_info.build_number; obj["build_string"] = pkg_info.build_string; obj["dist_name"] = pkg_info.str(); @@ -201,6 +203,8 @@ namespace mamba formatted_pkgs.build = package.second.build_string; formatted_pkgs.url = package.second.package_url; formatted_pkgs.md5 = package.second.md5; + formatted_pkgs.build_string = package.second.build_string; + formatted_pkgs.platform = package.second.platform; packages.push_back(formatted_pkgs); } } @@ -209,9 +213,13 @@ namespace mamba : compare_alphabetically; std::sort(packages.begin(), packages.end(), comparator); - // format and print table + // format and print output if (options.explicit_) { + if (options.canonical) + { + LOG_WARNING << "Option --canonical ignored because of --explicit"; + } for (auto p : packages) { if (options.md5) @@ -224,6 +232,14 @@ namespace mamba } } } + else if (options.canonical) + { + for (auto p : packages) + { + std::cout << p.channel << "/" << p.platform << "::" << p.name << "-" + << p.version << "-" << p.build_string << std::endl; + } + } else { auto requested_specs = prefix_data.history().get_requested_specs_map(); @@ -268,6 +284,7 @@ namespace mamba options.reverse = config.at("reverse").value(); options.explicit_ = config.at("explicit").value(); options.md5 = config.at("md5").value(); + options.canonical = config.at("canonical").value(); auto channel_context = ChannelContext::make_conda_compatible(config.context()); detail::list_packages(config.context(), regex, channel_context, std::move(options)); diff --git a/micromamba/src/list.cpp b/micromamba/src/list.cpp index 5d6776f7ec..9a68ac4aed 100644 --- a/micromamba/src/list.cpp +++ b/micromamba/src/list.cpp @@ -50,12 +50,12 @@ init_list_parser(CLI::App* subcom, Configuration& config) ); subcom->add_flag("--md5", md5.get_cli_config(), md5.description()); - - // TODO: implement this in libmamba/list.cpp - /*auto& canonical = config.insert(Configurable("canonical", false) - .group("cli") - .description("Output canonical names of packages only.")); - subcom->add_flag("-c,--canonical", canonical.get_cli_config(), canonical.description());*/ + auto& canonical = config.insert( + Configurable("canonical", false) + .group("cli") + .description("Output canonical names of packages only. Ignored if --explicit.") + ); + subcom->add_flag("-c,--canonical", canonical.get_cli_config(), canonical.description()); } void diff --git a/micromamba/tests/test_list.py b/micromamba/tests/test_list.py index b4530e107f..4550ca98db 100644 --- a/micromamba/tests/test_list.py +++ b/micromamba/tests/test_list.py @@ -81,17 +81,25 @@ def test_list_no_json( @pytest.mark.parametrize("explicit_flag", ["", "--explicit"]) @pytest.mark.parametrize("md5_flag", ["", "--md5"]) +@pytest.mark.parametrize("canonical_flag", ["", "-c", "--canonical"]) @pytest.mark.parametrize("env_selector", ["", "name", "prefix"]) @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) -def test_list_explicit( - tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_selector, explicit_flag, md5_flag +def test_list_subcommands( + tmp_home, + tmp_root_prefix, + tmp_env_name, + tmp_xtensor_env, + env_selector, + explicit_flag, + md5_flag, + canonical_flag, ): if env_selector == "prefix": - res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag) + res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag, canonical_flag) elif env_selector == "name": - res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag) + res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag, canonical_flag) else: - res = helpers.umamba_list(explicit_flag, md5_flag) + res = helpers.umamba_list(explicit_flag, md5_flag, canonical_flag) outputs_list = res.strip().split("\n")[2:] if explicit_flag == "--explicit": @@ -101,6 +109,12 @@ def test_list_explicit( assert "#" in output else: assert "#" not in output + else: + if canonical_flag == "--canonical": + items = ["conda-forge/", "::"] + for output in outputs_list: + assert all(i in output for i in items) + assert " " not in output @pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"]) From 109b47fddbe51cece7b2a12636734214ec37a91a Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 4 Feb 2025 09:16:30 +0200 Subject: [PATCH 05/14] ci: Rerun pytest tests on `main` in case of failures (#3769) Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille Co-authored-by: Hind Montassif --- .github/workflows/unix_impl.yml | 9 +++++++-- .github/workflows/windows_impl.yml | 11 ++++++++--- dev/environment-dev.yml | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index d152ada956..fff6bdc1cb 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -107,7 +107,10 @@ jobs: python -m pip install --no-deps --no-build-isolation ./libmambapy - name: Run libmamba Python bindings tests run: | - python -m pytest libmambapy/tests/ ${{ runner.debug == 'true' && '-v' || '--exitfirst' }} + # Only rerun flaky tests on the `main` branch + python -m pytest libmambapy/tests/ \ + ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} \ + ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} mamba_integration_tests_unix: name: mamba integration tests @@ -162,8 +165,10 @@ jobs: run: | export TEST_MAMBA_EXE=$(pwd)/build/micromamba/mamba unset CONDARC # Interferes with tests + # Only rerun flaky tests on the `main` branch python -m pytest micromamba/tests/ \ - ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} + ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} \ + ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} verify_pkg_tests: name: mamba-content-trust tests diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index f545d5e5bb..9afacf128d 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -116,7 +116,10 @@ jobs: python -m pip install --no-deps --no-build-isolation ./libmambapy - name: Run libmamba Python bindings tests run: | - python -m pytest libmambapy/tests/ ${{ runner.debug == 'true' && '-v' || '--exitfirst' }} + # Only rerun flaky tests on the `main` branch + python -m pytest libmambapy/tests/ \ + ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} \ + ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} mamba_integration_tests_win: name: mamba integration tests @@ -149,5 +152,7 @@ jobs: $env:TEST_MAMBA_EXE = Join-Path -Path $pwd -ChildPath 'local\bin\mamba.exe' $env:MAMBA_TEST_SHELL_TYPE='powershell' Remove-Item -Path "env:CONDARC" - python -m pytest micromamba/tests/ ` - ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} + # Only rerun flaky tests on the `main` branch + python -m pytest micromamba/tests/ \ + ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} \ + ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index 7fe8da59b4..f51e00827f 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -31,6 +31,7 @@ dependencies: - pytest-asyncio - pytest-timeout - pytest-xprocess + - pytest-rerunfailures - memory_profiler - requests - sel(win): pywin32 From d2a444cffd8cb3d4cfc772df966989e71dcb227c Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 4 Feb 2025 11:21:39 +0200 Subject: [PATCH 06/14] fix: Use `libmamba`'s installation instead of `mamba`'s as a fallback (#3792) Signed-off-by: Julien Jerphanion --- libmamba/src/api/configuration.cpp | 57 +++++++++++++----------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index d368e883c6..a09720c77e 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -629,21 +629,6 @@ namespace mamba } } - auto get_root_prefix_from_mamba_bin(const fs::u8path& mamba_bin_path) - -> expected_t - { - if (mamba_bin_path.empty()) - { - return make_unexpected( - "The root prefix of your installation cannot be found.\nPlease set `MAMBA_ROOT_PREFIX`.", - mamba_error_code::incorrect_usage - ); - } - // In linux and osx, the install path would be install_prefix/bin/mamba - // In windows, install_prefix/Scripts/mamba.exe - return { fs::weakly_canonical(mamba_bin_path.parent_path().parent_path()) }; - } - auto validate_existing_root_prefix(const fs::u8path& candidate) -> expected_t { auto prefix = fs::u8path(util::expand_home(candidate.string())); @@ -737,38 +722,44 @@ namespace mamba // Find the location of libmamba const fs::u8path libmamba_path = get_libmamba_path(); - // Find the environment directory of the executable - const fs::u8path env_prefix = fs::weakly_canonical( - libmamba_path.parent_path().parent_path() + // Find the supposed environment prefix of libmamba. + // `libmamba` is installed at: + // - `${PREFIX}/lib/libmamba${SHLIB_EXT}` on Unix + // - `${PREFIX}/Library/bin/libmamba$.dll` on Windows + const fs::u8path libmamba_env_prefix = fs::weakly_canonical( + util::on_win ? libmamba_path.parent_path().parent_path().parent_path() + : libmamba_path.parent_path().parent_path() + ); + + // If `libmamba` is installed in another environment than `base`, then the + // root prefix is likely the grand-parent directory (i.e. + // `$ROOT_PREFIX/envs/libmamba_env_prefix`). + const fs::u8path inferred_root_prefix = fs::weakly_canonical( + libmamba_env_prefix.parent_path().parent_path() ); - if (auto maybe_prefix = validate_existing_root_prefix(env_prefix); + if (auto maybe_prefix = validate_existing_root_prefix(inferred_root_prefix); maybe_prefix.has_value()) { - LOG_TRACE << "Using `libmamba`'s current environment as the root prefix: " + LOG_TRACE << "Inferring and using the root prefix from `libmamba`'s current environment' as: " << maybe_prefix.value(); return maybe_prefix.value(); } - // From the environment directory, we might infer the root prefix. - const fs::u8path inferred_root_prefix = fs::weakly_canonical( - env_prefix.parent_path().parent_path() - ); - - if (auto maybe_prefix = validate_existing_root_prefix(env_prefix); + // Otherwise `libmamba` might be directly installed in the root prefix. + if (auto maybe_prefix = validate_existing_root_prefix(libmamba_env_prefix); maybe_prefix.has_value()) { - LOG_TRACE << "Inferring and using the root prefix from `libmamba`'s current environment' as: " + LOG_TRACE << "Using `libmamba`'s current environment as the root prefix: " << maybe_prefix.value(); return maybe_prefix.value(); } #ifdef MAMBA_USE_INSTALL_PREFIX_AS_BASE - // mamba case - // set the root prefix as the mamba installation path - get_root_prefix_from_mamba_bin(util::which("mamba")) - .transform([&](fs::u8path&& p) { root_prefix = std::move(p); }) - .or_else([](mamba_error&& error) { throw std::move(error); }); + // libmamba case: set the root prefix as libmamba's installation path as a last resort. + LOG_TRACE << "Using libmamba's installation path as the root prefix: " + << libmamba_env_prefix; + return libmamba_env_prefix; #else // micromamba case // In 1.0, only micromamba was using this location. @@ -785,6 +776,8 @@ namespace mamba { return validate_root_prefix(default_root_prefix_v2); }) .transform([&](fs::u8path&& p) { root_prefix = std::move(p); }) .or_else([](mamba_error&& error) { throw std::move(error); }); + + LOG_TRACE << "Using default root prefix for micromamba: " << root_prefix; #endif return root_prefix; } From dac50d8a8ad2441b3acbd243d781ff64e1024cc8 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 4 Feb 2025 11:37:03 +0200 Subject: [PATCH 07/14] ci: Fix typo in Windows workflows (#3793) Signed-off-by: Julien Jerphanion --- .github/workflows/windows_impl.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index 9afacf128d..c15bac6a62 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -117,9 +117,7 @@ jobs: - name: Run libmamba Python bindings tests run: | # Only rerun flaky tests on the `main` branch - python -m pytest libmambapy/tests/ \ - ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} \ - ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} + python -m pytest libmambapy/tests/ ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} mamba_integration_tests_win: name: mamba integration tests @@ -153,6 +151,4 @@ jobs: $env:MAMBA_TEST_SHELL_TYPE='powershell' Remove-Item -Path "env:CONDARC" # Only rerun flaky tests on the `main` branch - python -m pytest micromamba/tests/ \ - ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} \ - ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} + python -m pytest micromamba/tests/ ${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }} ${{ github.ref == 'refs/heads/main' && '--reruns 3' || '' }} From f201df2288be3779b988cf23234fd63384621bf7 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 4 Feb 2025 11:45:16 +0200 Subject: [PATCH 08/14] maint: Warn about future removal of `etc/profile.d/mamba.sh` (#3788) Signed-off-by: Julien Jerphanion --- micromamba/etc/profile.d/mamba.sh.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/micromamba/etc/profile.d/mamba.sh.in b/micromamba/etc/profile.d/mamba.sh.in index f3ee55d68a..cf9aa7f08c 100644 --- a/micromamba/etc/profile.d/mamba.sh.in +++ b/micromamba/etc/profile.d/mamba.sh.in @@ -1,7 +1,19 @@ +echo "WARNING: @CMAKE_INSTALL_PREFIX@/etc/profile.d/mamba.sh (the file emitting this warning) is deprecated." +echo "WARNING: This file will be removed in mamba 2.1.0." +echo "WARNING: Please use 'mamba shell init' to get the correct shell scripts for your shell." + if [ -z "${MAMBA_ROOT_PREFIX}" ]; then - echo "WARNING: MAMBA_ROOT_PREFIX is not set." - echo "WARNING: Please set `MAMBA_ROOT_PREFIX` to the root of your installation." - echo "WARNING: For now continuing with `MAMBA_ROOT_PREFIX` set to `@CMAKE_INSTALL_PREFIX@`." + echo "WARNING: The MAMBA_ROOT_PREFIX environment variable is not set." + echo "WARNING: This is required for mamba to work correctly as of 2.0." + echo "WARNING: " + echo "WARNING: For now, we are setting 'MAMBA_ROOT_PREFIX' to '@CMAKE_INSTALL_PREFIX@'." + echo "WARNING: " + echo "WARNING: Please make sure this is consistent with your installation or alternatively (by order of preference):" + echo "WARNING: - rerun 'mamba shell init -s posix' to get the correct value" + echo "WARNING: - manually set 'MAMBA_ROOT_PREFIX' to the root of your installation in your shell profile script." + echo "WARNING: - use the '-r,--root-prefix' CLI option when calling mamba." + echo "WARNING: " + echo "WARNING: This message originates from @CMAKE_INSTALL_PREFIX@/etc/profile.d/mamba.sh" export MAMBA_ROOT_PREFIX="@CMAKE_INSTALL_PREFIX@" fi From 4ef767721d43ff0ee23ee81d1490a4a5d4ecedd5 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 4 Feb 2025 11:32:30 +0100 Subject: [PATCH 09/14] release libmamba 2.0.6.rc3, micromamba 2.0.6.rc3, libmambapy 2.0.6.rc3 --- CHANGELOG.md | 18 ++++++++++++++++++ libmamba/CHANGELOG.md | 15 +++++++++++++++ libmamba/include/mamba/version.hpp | 4 ++-- libmambapy/CHANGELOG.md | 15 +++++++++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 15 +++++++++++++++ micromamba/src/version.hpp | 4 ++-- 7 files changed, 68 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb1e6844a..75053d0672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# 2025.02.04 + +Release: 2.0.6.rc3 (libmamba, mamba, micromamba, libmambapy) + +Enhancement: + +- [all] add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- [all] Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 + +Maintenance: + +- [mamba] Warn about future removal of `etc/profile.d/mamba.sh` by @jjerphan in https://github.com/mamba-org/mamba/pull/3788 +- [all] Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- [all] Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + # 2025.01.31 Release: 2.0.6.rc2 (libmamba, mamba, micromamba, libmambapy) diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 5e8f813fb5..6269f984c1 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,18 @@ +# libmamba 2.0.6.rc3 (February 04, 2025) + +Enhancement: + +- add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 + +Maintenance: + +- Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + # libmamba 2.0.6.rc2 (January 31, 2025) Enhancements: diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index 2f7e792904..a4d9f6d623 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -15,10 +15,10 @@ #define LIBMAMBA_VERSION_PATCH 6 #define LIBMAMBA_VERSION_IS_PRERELEASE 1 #if LIBMAMBA_VERSION_IS_PRERELEASE == 1 -#define LIBMAMBA_VERSION_PRERELEASE_NAME "rc2" +#define LIBMAMBA_VERSION_PRERELEASE_NAME "rc3" #endif -#define LIBMAMBA_VERSION_STRING "2.0.6.rc2" +#define LIBMAMBA_VERSION_STRING "2.0.6.rc3" #define LIBMAMBA_VERSION \ (LIBMAMBA_VERSION_MAJOR * 10000 + LIBMAMBA_VERSION_MINOR * 100 + LIBMAMBA_VERSION_PATCH) diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index efd89302d9..f1501b62f7 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,18 @@ +# libmambapy 2.0.6.rc3 (February 04, 2025) + +Enhancement: + +- add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 + +Maintenance: + +- Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + # libmambapy 2.0.6.rc2 (January 31, 2025) Enhancements: diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index 653d6f11b7..3701d4fbaa 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,5 +1,5 @@ version_info = ("2", "0", "6") -version_prerelease = "rc2" +version_prerelease = "rc3" __version__ = ".".join(map(str, version_info)) if version_prerelease != "": __version__ = f"{__version__}.{version_prerelease}" diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 4014c89abe..2c946af06a 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,18 @@ +# micromamba 2.0.6.rc3 (February 04, 2025) + +Enhancement: + +- add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 + +Maintenance: + +- Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + # micromamba 2.0.6.rc2 (January 31, 2025) Enhancements: diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index 172b281e24..741e65429e 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -15,10 +15,10 @@ #define UMAMBA_VERSION_PATCH 6 #define UMAMBA_VERSION_IS_PRERELEASE 1 #if UMAMBA_VERSION_IS_PRERELEASE == 1 -#define UMAMBA_VERSION_PRERELEASE_NAME "rc2" +#define UMAMBA_VERSION_PRERELEASE_NAME "rc3" #endif -#define UMAMBA_VERSION_STRING "2.0.6.rc2" +#define UMAMBA_VERSION_STRING "2.0.6.rc3" #define UMAMBA_VERSION \ (UMAMBA_VERSION_MAJOR * 10000 + UMAMBA_VERSION_MINOR * 100 + UMAMBA_VERSION_PATCH) From 1747cd8790d9a8dc3985a23392576fbe2e6e026b Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 4 Feb 2025 15:28:34 +0100 Subject: [PATCH 10/14] release libmamba 2.0.6, micromamba 2.0.6, libmambapy 2.0.6 --- CHANGELOG.md | 58 ++++++++++++++++++++++++++++ libmamba/CHANGELOG.md | 52 +++++++++++++++++++++++++ libmamba/include/mamba/version.hpp | 6 +-- libmambapy/CHANGELOG.md | 52 +++++++++++++++++++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 53 +++++++++++++++++++++++++ micromamba/src/version.hpp | 6 +-- 7 files changed, 222 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75053d0672..533c9a516b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,63 @@ # 2025.02.04 +Release: 2.0.6 (libmamba, mamba, micromamba, libmambapy) + +Enhancements: + +- [all] Add reverse flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3705 +- [all] Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 +- [all] add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- [all] Correctly populate lists of `MatchSpec` in `MTransaction`'s history by @Hind-M in https://github.com/mamba-org/mamba/pull/3724 +- [all] Honour `CONDA_ENVS_PATH` again by @jjerphan in https://github.com/mamba-org/mamba/pull/3725 +- [all] Improve CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3700 +- [all] Support installation using explicit url by @Hind-M in https://github.com/mamba-org/mamba/pull/3710 +- [all] Improve display of environment activation message by @Hind-M in https://github.com/mamba-org/mamba/pull/3715 +- [all] Adapt warnings shown when several channels are used by @jjerphan in https://github.com/mamba-org/mamba/pull/3720 +- [all] Add a hint on cache corruption by @jjerphan in https://github.com/mamba-org/mamba/pull/3736 +- [all] Support more condarc paths by @SandrineP in https://github.com/mamba-org/mamba/pull/3695 +- [all] Always add `root_prefix/envs` in `envs_dirs` by @Hind-M in https://github.com/mamba-org/mamba/pull/3692 +- [mamba] Generate and install `etc/profile.d/mamba.sh` by @jjerphan in https://github.com/mamba-org/mamba/pull/3723 +- [mamba] Add `no-pip` flag to `list` command by @Hind-M in https://github.com/mamba-org/mamba/pull/3696 +- [mamba, micromamba] Options args enhancement by @Hind-M in https://github.com/mamba-org/mamba/pull/3722 +- [all] Support globs in `MatchSpec` build strings by @jjerphan in https://github.com/mamba-org/mamba/pull/3735 +- [all] Don't encode URLs for `mamba env export --explicit` by @maresb in https://github.com/mamba-org/mamba/pull/3745 +- [all] Handle `git+https` pip urls by @Hind-M in https://github.com/mamba-org/mamba/pull/3764 +- [all] Uncomment no more failing test by @Hind-M in https://github.com/mamba-org/mamba/pull/3767 +- [all] Use CA certificates from `conda-forge::ca-certificates` by @jjerphan in https://github.com/mamba-org/mamba/pull/3765 +- [all] Add explicit flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3760 +- [all] Fix dependency and `subdir` in repoquery `whoneeds` by @Hind-M in https://github.com/mamba-org/mamba/pull/3743 +- [all] Use `LOG_DEBUG` for CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3757 +- [all] Add missing thread and undefined sanitizers CMake options by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3753 +- [all] Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- [all] Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- [all] Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 +- [all] Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 +- [mamba] Warn about future removal of `etc/profile.d/mamba.sh` by @jjerphan in https://github.com/mamba-org/mamba/pull/3788 +- [all] Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- [all] Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + +CI fixes and doc: + +- [all] Use a portable web request for Windows by @jjerphan in https://github.com/mamba-org/mamba/pull/3704 +- [all] Add prettier pre-commit hook by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3663 +- [all] Document slight differences for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3697 +- [all] Unique Release Tag by @Klaim in https://github.com/mamba-org/mamba/pull/3732 +- [all] Update Linux installation script for Nushell by @deephbz in https://github.com/mamba-org/mamba/pull/3721 +- [all] `update_changelog.py` now can also take input as cli parameters by @Klaim in https://github.com/mamba-org/mamba/pull/3731 + +Maintenance: + +- [all] `list` refactoring by @SandrineP in https://github.com/mamba-org/mamba/pull/3768 +- [all] Correctly exclude json files in clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3749 +- [all] Fix build status badge by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3755 +- [all] Don't exclude Changelog files from typos-conda by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3748 +- [all] Update pre-commit hooks by by @mathbunnyru https://github.com/mamba-org/mamba/pull/3746 + +# 2025.02.04 + Release: 2.0.6.rc3 (libmamba, mamba, micromamba, libmambapy) Enhancement: diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 6269f984c1..79b58aa6c5 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,55 @@ +# libmamba 2.0.6 (February 04, 2025) + +Enhancements: + +- Add reverse flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3705 +- Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 +- add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- Correctly populate lists of `MatchSpec` in `MTransaction`'s history by @Hind-M in https://github.com/mamba-org/mamba/pull/3724 +- Honour `CONDA_ENVS_PATH` again by @jjerphan in https://github.com/mamba-org/mamba/pull/3725 +- Improve CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3700 +- Support installation using explicit url by @Hind-M in https://github.com/mamba-org/mamba/pull/3710 +- Improve display of environment activation message by @Hind-M in https://github.com/mamba-org/mamba/pull/3715 +- Adapt warnings shown when several channels are used by @jjerphan in https://github.com/mamba-org/mamba/pull/3720 +- Add a hint on cache corruption by @jjerphan in https://github.com/mamba-org/mamba/pull/3736 +- Support more condarc paths by @SandrineP in https://github.com/mamba-org/mamba/pull/3695 +- Always add `root_prefix/envs` in `envs_dirs` by @Hind-M in https://github.com/mamba-org/mamba/pull/3692 +- Support globs in `MatchSpec` build strings by @jjerphan in https://github.com/mamba-org/mamba/pull/3735 +- Don't encode URLs for `mamba env export --explicit` by @maresb in https://github.com/mamba-org/mamba/pull/3745 +- Handle `git+https` pip urls by @Hind-M in https://github.com/mamba-org/mamba/pull/3764 +- Uncomment no more failing test by @Hind-M in https://github.com/mamba-org/mamba/pull/3767 +- Use CA certificates from `conda-forge::ca-certificates` by @jjerphan in https://github.com/mamba-org/mamba/pull/3765 +- Add explicit flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3760 +- Fix dependency and `subdir` in repoquery `whoneeds` by @Hind-M in https://github.com/mamba-org/mamba/pull/3743 +- Use `LOG_DEBUG` for CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3757 +- Add missing thread and undefined sanitizers CMake options by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3753 +- Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 +- Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 +- Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + +CI fixes and doc: + +- Use a portable web request for Windows by @jjerphan in https://github.com/mamba-org/mamba/pull/3704 +- Add prettier pre-commit hook by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3663 +- Document slight differences for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3697 +- Unique Release Tag by @Klaim in https://github.com/mamba-org/mamba/pull/3732 +- Update Linux installation script for Nushell by @deephbz in https://github.com/mamba-org/mamba/pull/3721 +- `update_changelog.py` now can also take input as cli parameters by @Klaim in https://github.com/mamba-org/mamba/pull/3731 + +Maintenance: + +- `list` refactoring by @SandrineP in https://github.com/mamba-org/mamba/pull/3768 +- Correctly exclude json files in clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3749 +- Fix build status badge by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3755 +- Don't exclude Changelog files from typos-conda by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3748 +- Update pre-commit hooks by by @mathbunnyru https://github.com/mamba-org/mamba/pull/3746 + # libmamba 2.0.6.rc3 (February 04, 2025) Enhancement: diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index a4d9f6d623..3b502df729 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -13,12 +13,12 @@ #define LIBMAMBA_VERSION_MAJOR 2 #define LIBMAMBA_VERSION_MINOR 0 #define LIBMAMBA_VERSION_PATCH 6 -#define LIBMAMBA_VERSION_IS_PRERELEASE 1 +#define LIBMAMBA_VERSION_IS_PRERELEASE 0 #if LIBMAMBA_VERSION_IS_PRERELEASE == 1 -#define LIBMAMBA_VERSION_PRERELEASE_NAME "rc3" +#define LIBMAMBA_VERSION_PRERELEASE_NAME "" #endif -#define LIBMAMBA_VERSION_STRING "2.0.6.rc3" +#define LIBMAMBA_VERSION_STRING "2.0.6" #define LIBMAMBA_VERSION \ (LIBMAMBA_VERSION_MAJOR * 10000 + LIBMAMBA_VERSION_MINOR * 100 + LIBMAMBA_VERSION_PATCH) diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index f1501b62f7..f2f4e4d8bb 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,55 @@ +# libmambapy 2.0.6 (February 04, 2025) + +Enhancements: + +- Add reverse flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3705 +- Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 +- add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- Correctly populate lists of `MatchSpec` in `MTransaction`'s history by @Hind-M in https://github.com/mamba-org/mamba/pull/3724 +- Honour `CONDA_ENVS_PATH` again by @jjerphan in https://github.com/mamba-org/mamba/pull/3725 +- Improve CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3700 +- Support installation using explicit url by @Hind-M in https://github.com/mamba-org/mamba/pull/3710 +- Improve display of environment activation message by @Hind-M in https://github.com/mamba-org/mamba/pull/3715 +- Adapt warnings shown when several channels are used by @jjerphan in https://github.com/mamba-org/mamba/pull/3720 +- Add a hint on cache corruption by @jjerphan in https://github.com/mamba-org/mamba/pull/3736 +- Support more condarc paths by @SandrineP in https://github.com/mamba-org/mamba/pull/3695 +- Always add `root_prefix/envs` in `envs_dirs` by @Hind-M in https://github.com/mamba-org/mamba/pull/3692 +- Support globs in `MatchSpec` build strings by @jjerphan in https://github.com/mamba-org/mamba/pull/3735 +- Don't encode URLs for `mamba env export --explicit` by @maresb in https://github.com/mamba-org/mamba/pull/3745 +- Handle `git+https` pip urls by @Hind-M in https://github.com/mamba-org/mamba/pull/3764 +- Uncomment no more failing test by @Hind-M in https://github.com/mamba-org/mamba/pull/3767 +- Use CA certificates from `conda-forge::ca-certificates` by @jjerphan in https://github.com/mamba-org/mamba/pull/3765 +- Add explicit flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3760 +- Fix dependency and `subdir` in repoquery `whoneeds` by @Hind-M in https://github.com/mamba-org/mamba/pull/3743 +- Use `LOG_DEBUG` for CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3757 +- Add missing thread and undefined sanitizers CMake options by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3753 +- Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 +- Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 +- Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + +CI fixes and doc: + +- Use a portable web request for Windows by @jjerphan in https://github.com/mamba-org/mamba/pull/3704 +- Add prettier pre-commit hook by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3663 +- Document slight differences for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3697 +- Unique Release Tag by @Klaim in https://github.com/mamba-org/mamba/pull/3732 +- Update Linux installation script for Nushell by @deephbz in https://github.com/mamba-org/mamba/pull/3721 +- `update_changelog.py` now can also take input as cli parameters by @Klaim in https://github.com/mamba-org/mamba/pull/3731 + +Maintenance: + +- `list` refactoring by @SandrineP in https://github.com/mamba-org/mamba/pull/3768 +- Correctly exclude json files in clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3749 +- Fix build status badge by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3755 +- Don't exclude Changelog files from typos-conda by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3748 +- Update pre-commit hooks by by @mathbunnyru https://github.com/mamba-org/mamba/pull/3746 + # libmambapy 2.0.6.rc3 (February 04, 2025) Enhancement: diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index 3701d4fbaa..7f4d14d26c 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,5 +1,5 @@ version_info = ("2", "0", "6") -version_prerelease = "rc3" +version_prerelease = "" __version__ = ".".join(map(str, version_info)) if version_prerelease != "": __version__ = f"{__version__}.{version_prerelease}" diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 2c946af06a..79190eb6fa 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,56 @@ +# micromamba 2.0.6 (February 04, 2025) + +Enhancements: + +- Add reverse flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3705 +- Add md5 flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3773 +- add canonical flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3777 + +Bug fixes: + +- Correctly populate lists of `MatchSpec` in `MTransaction`'s history by @Hind-M in https://github.com/mamba-org/mamba/pull/3724 +- Honour `CONDA_ENVS_PATH` again by @jjerphan in https://github.com/mamba-org/mamba/pull/3725 +- Improve CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3700 +- Support installation using explicit url by @Hind-M in https://github.com/mamba-org/mamba/pull/3710 +- Improve display of environment activation message by @Hind-M in https://github.com/mamba-org/mamba/pull/3715 +- Adapt warnings shown when several channels are used by @jjerphan in https://github.com/mamba-org/mamba/pull/3720 +- Add a hint on cache corruption by @jjerphan in https://github.com/mamba-org/mamba/pull/3736 +- Support more condarc paths by @SandrineP in https://github.com/mamba-org/mamba/pull/3695 +- Always add `root_prefix/envs` in `envs_dirs` by @Hind-M in https://github.com/mamba-org/mamba/pull/3692 +- Options args enhancement by @Hind-M in https://github.com/mamba-org/mamba/pull/3722 +- Support globs in `MatchSpec` build strings by @jjerphan in https://github.com/mamba-org/mamba/pull/3735 +- Don't encode URLs for `mamba env export --explicit` by @maresb in https://github.com/mamba-org/mamba/pull/3745 +- Handle `git+https` pip urls by @Hind-M in https://github.com/mamba-org/mamba/pull/3764 +- Uncomment no more failing test by @Hind-M in https://github.com/mamba-org/mamba/pull/3767 +- Use CA certificates from `conda-forge::ca-certificates` by @jjerphan in https://github.com/mamba-org/mamba/pull/3765 +- Add explicit flag to list command by @SandrineP in https://github.com/mamba-org/mamba/pull/3760 +- Fix dependency and `subdir` in repoquery `whoneeds` by @Hind-M in https://github.com/mamba-org/mamba/pull/3743 +- Use `LOG_DEBUG` for CUDA version detection by @jjerphan in https://github.com/mamba-org/mamba/pull/3757 +- Add missing thread and undefined sanitizers CMake options by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3753 +- Factor handling of `GetModuleFileNameW` by @jjerphan in https://github.com/mamba-org/mamba/pull/3785 +- Adapt root prefix determination by @jjerphan in https://github.com/mamba-org/mamba/pull/3782 +- Remove pip warning for `PIP_NO_PYTHON_VERSION_WARNING` by @Hind-M in https://github.com/mamba-org/mamba/pull/3770 +- Use `libmamba`'s installation instead of `mamba`'s as a fallback by @jjerphan in https://github.com/mamba-org/mamba/pull/3792 +- Fix typo in Windows workflows by @jjerphan in https://github.com/mamba-org/mamba/pull/3793 +- Rerun pytest tests on `main` in case of failures by @jjerphan in https://github.com/mamba-org/mamba/pull/3769 + +CI fixes and doc: + +- Use a portable web request for Windows by @jjerphan in https://github.com/mamba-org/mamba/pull/3704 +- Add prettier pre-commit hook by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3663 +- Document slight differences for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3697 +- Unique Release Tag by @Klaim in https://github.com/mamba-org/mamba/pull/3732 +- Update Linux installation script for Nushell by @deephbz in https://github.com/mamba-org/mamba/pull/3721 +- `update_changelog.py` now can also take input as cli parameters by @Klaim in https://github.com/mamba-org/mamba/pull/3731 + +Maintenance: + +- `list` refactoring by @SandrineP in https://github.com/mamba-org/mamba/pull/3768 +- Correctly exclude json files in clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3749 +- Fix build status badge by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3755 +- Don't exclude Changelog files from typos-conda by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3748 +- Update pre-commit hooks by by @mathbunnyru https://github.com/mamba-org/mamba/pull/3746 + # micromamba 2.0.6.rc3 (February 04, 2025) Enhancement: diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index 741e65429e..94d0c906e9 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -13,12 +13,12 @@ #define UMAMBA_VERSION_MAJOR 2 #define UMAMBA_VERSION_MINOR 0 #define UMAMBA_VERSION_PATCH 6 -#define UMAMBA_VERSION_IS_PRERELEASE 1 +#define UMAMBA_VERSION_IS_PRERELEASE 0 #if UMAMBA_VERSION_IS_PRERELEASE == 1 -#define UMAMBA_VERSION_PRERELEASE_NAME "rc3" +#define UMAMBA_VERSION_PRERELEASE_NAME "" #endif -#define UMAMBA_VERSION_STRING "2.0.6.rc3" +#define UMAMBA_VERSION_STRING "2.0.6" #define UMAMBA_VERSION \ (UMAMBA_VERSION_MAJOR * 10000 + UMAMBA_VERSION_MINOR * 100 + UMAMBA_VERSION_PATCH) From bc0b7dbd7a36ec5abaf46ccd881e08def1d5798f Mon Sep 17 00:00:00 2001 From: Sandrine Pataut Date: Tue, 4 Feb 2025 19:25:10 +0100 Subject: [PATCH 11/14] feat: add export flag to list command (#3780) --- libmamba/src/api/list.cpp | 22 +++++++++++++++++++++- micromamba/src/list.cpp | 12 +++++++++++- micromamba/tests/test_list.py | 29 ++++++++++++++++++++--------- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index cfc689c209..d42f8e182a 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -28,6 +28,7 @@ namespace mamba bool explicit_ = false; bool md5 = false; bool canonical = false; + bool export_ = false; }; struct formatted_pkg @@ -218,7 +219,13 @@ namespace mamba { if (options.canonical) { - LOG_WARNING << "Option --canonical ignored because of --explicit"; + LOG_WARNING + << "Option --canonical ignored because --explicit was also provided."; + } + if (options.export_) + { + LOG_WARNING + << "Option --export ignored because --explicit was also provided."; } for (auto p : packages) { @@ -234,12 +241,24 @@ namespace mamba } else if (options.canonical) { + if (options.export_) + { + LOG_WARNING + << "Option --export ignored because --canonical was also provided."; + } for (auto p : packages) { std::cout << p.channel << "/" << p.platform << "::" << p.name << "-" << p.version << "-" << p.build_string << std::endl; } } + else if (options.export_) + { + for (auto p : packages) + { + std::cout << p.name << "=" << p.version << "=" << p.build_string << std::endl; + } + } else { auto requested_specs = prefix_data.history().get_requested_specs_map(); @@ -285,6 +304,7 @@ namespace mamba options.explicit_ = config.at("explicit").value(); options.md5 = config.at("md5").value(); options.canonical = config.at("canonical").value(); + options.export_ = config.at("export").value(); auto channel_context = ChannelContext::make_conda_compatible(config.context()); detail::list_packages(config.context(), regex, channel_context, std::move(options)); diff --git a/micromamba/src/list.cpp b/micromamba/src/list.cpp index 9a68ac4aed..5a3a552507 100644 --- a/micromamba/src/list.cpp +++ b/micromamba/src/list.cpp @@ -53,9 +53,19 @@ init_list_parser(CLI::App* subcom, Configuration& config) auto& canonical = config.insert( Configurable("canonical", false) .group("cli") - .description("Output canonical names of packages only. Ignored if --explicit.") + .description("Output canonical names of packages only. Ignored if --explicit is also provided." + ) ); subcom->add_flag("-c,--canonical", canonical.get_cli_config(), canonical.description()); + + auto& export_ = config.insert( + Configurable("export", false) + .group("cli") + .description( + "Output explicit, machine-readable requirement strings instead of human-readable lists of packages. Ignored if --explicit or --canonical is also provided." + ) + ); + subcom->add_flag("-e,--export", export_.get_cli_config(), export_.description()); } void diff --git a/micromamba/tests/test_list.py b/micromamba/tests/test_list.py index 4550ca98db..265e6a84ba 100644 --- a/micromamba/tests/test_list.py +++ b/micromamba/tests/test_list.py @@ -82,6 +82,7 @@ def test_list_no_json( @pytest.mark.parametrize("explicit_flag", ["", "--explicit"]) @pytest.mark.parametrize("md5_flag", ["", "--md5"]) @pytest.mark.parametrize("canonical_flag", ["", "-c", "--canonical"]) +@pytest.mark.parametrize("export_flag", ["", "-e", "--export"]) @pytest.mark.parametrize("env_selector", ["", "name", "prefix"]) @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) def test_list_subcommands( @@ -93,15 +94,22 @@ def test_list_subcommands( explicit_flag, md5_flag, canonical_flag, + export_flag, ): if env_selector == "prefix": - res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag, canonical_flag) + res = helpers.umamba_list( + "-p", tmp_xtensor_env, explicit_flag, md5_flag, canonical_flag, export_flag + ) elif env_selector == "name": - res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag, canonical_flag) + res = helpers.umamba_list( + "-n", tmp_env_name, explicit_flag, md5_flag, canonical_flag, export_flag + ) else: - res = helpers.umamba_list(explicit_flag, md5_flag, canonical_flag) + res = helpers.umamba_list(explicit_flag, md5_flag, canonical_flag, export_flag) outputs_list = res.strip().split("\n")[2:] + outputs_list = [i for i in outputs_list if i != "" and not i.startswith("Warning")] + items = ["conda-forge/", "::"] if explicit_flag == "--explicit": for output in outputs_list: assert "/conda-forge/" in output @@ -109,12 +117,15 @@ def test_list_subcommands( assert "#" in output else: assert "#" not in output - else: - if canonical_flag == "--canonical": - items = ["conda-forge/", "::"] - for output in outputs_list: - assert all(i in output for i in items) - assert " " not in output + elif canonical_flag in ["-c", "--canonical"]: + for output in outputs_list: + assert all(i in output for i in items) + assert " " not in output + elif export_flag in ["-e", "--export"]: + items += [" "] + for output in outputs_list: + assert all(i not in output for i in items) + assert len(output.split("=")) == 3 @pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"]) From f7d55c80ef502f2ff2944d81d7483c577df06a7f Mon Sep 17 00:00:00 2001 From: Sandrine Pataut Date: Fri, 31 Jan 2025 10:38:00 +0100 Subject: [PATCH 12/14] minor fix --- micromamba/src/info.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/micromamba/src/info.cpp b/micromamba/src/info.cpp index 3f931b16a7..bfef050714 100644 --- a/micromamba/src/info.cpp +++ b/micromamba/src/info.cpp @@ -10,8 +10,6 @@ #include "common_options.hpp" -using namespace mamba; - void init_info_parser(CLI::App* subcom, mamba::Configuration& config) { @@ -26,7 +24,7 @@ set_info_command(CLI::App* subcom, mamba::Configuration& config) static bool print_licenses; auto& base = config.insert( - Configurable("base", false).group("cli").description("Display base environment path.") + mamba::Configurable("base", false).group("cli").description("Display base environment path.") ); subcom->add_flag("--base", base.get_cli_config(), base.description()); From c3f7a427406300bde3544a7efede7f1b192b88f5 Mon Sep 17 00:00:00 2001 From: Sandrine Pataut Date: Mon, 3 Feb 2025 15:11:23 +0100 Subject: [PATCH 13/14] add base test --- micromamba/tests/test_info.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/micromamba/tests/test_info.py b/micromamba/tests/test_info.py index 3fccbebead..c55afad95a 100644 --- a/micromamba/tests/test_info.py +++ b/micromamba/tests/test_info.py @@ -78,3 +78,27 @@ def test_not_env(tmp_home, tmp_root_prefix, prefix_selection, existing_prefix): assert f"env location : {location}" in infos assert f"user config files : {tmp_home / '.mambarc'}" in infos assert f"base environment : {tmp_root_prefix}" in infos + + +@pytest.mark.parametrize("base_flag", ["", "--base"]) +@pytest.mark.parametrize("prefix_selection", [None, "prefix", "name"]) +def test_base_subcommand(tmp_home, tmp_root_prefix, prefix_selection, base_flag): + os.environ["CONDA_PREFIX"] = str(tmp_root_prefix) + + if prefix_selection == "prefix": + infos = helpers.info("-p", tmp_root_prefix, base_flag) + elif prefix_selection == "name": + infos = helpers.info("-n", "base", base_flag) + else: + infos = helpers.info() + + items = ["libmamba version", "mamba version", "curl version", "libarchive version", "envs directories", + "package cache", "environment", "env location", "user config files", "populated config files", + "user config files", "virtual packages", "channels", "base environment", "platform"] + if base_flag == "--base": + print(infos) + # assert all(f"{i} :" not in infos for i in items) + # assert os.path.exists(infos) + else: + assert all(i in infos for i in items) + From d473b054382dea664f988edd66e49fa7859f4091 Mon Sep 17 00:00:00 2001 From: Sandrine Pataut Date: Thu, 6 Feb 2025 16:49:28 +0100 Subject: [PATCH 14/14] edit test --- micromamba/tests/test_info.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/micromamba/tests/test_info.py b/micromamba/tests/test_info.py index c55afad95a..181ad95de2 100644 --- a/micromamba/tests/test_info.py +++ b/micromamba/tests/test_info.py @@ -90,15 +90,28 @@ def test_base_subcommand(tmp_home, tmp_root_prefix, prefix_selection, base_flag) elif prefix_selection == "name": infos = helpers.info("-n", "base", base_flag) else: - infos = helpers.info() - - items = ["libmamba version", "mamba version", "curl version", "libarchive version", "envs directories", - "package cache", "environment", "env location", "user config files", "populated config files", - "user config files", "virtual packages", "channels", "base environment", "platform"] + infos = helpers.info(base_flag) + + items = [ + "libmamba version", + "mamba version", + "curl version", + "libarchive version", + "envs directories", + "package cache", + "environment", + "env location", + "user config files", + "populated config files", + "user config files", + "virtual packages", + "channels", + "base environment", + "platform", + ] if base_flag == "--base": print(infos) - # assert all(f"{i} :" not in infos for i in items) - # assert os.path.exists(infos) + assert all(f"{i} :" not in infos for i in items) + assert os.path.exists(infos.strip()) else: assert all(i in infos for i in items) -