Skip to content

Commit

Permalink
Comment rstrip_excessive_free
Browse files Browse the repository at this point in the history
  • Loading branch information
Hind-M committed Nov 20, 2024
1 parent f2a0711 commit ebcd215
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions libmamba/src/solver/problems_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,20 +1322,28 @@ namespace mamba::solver
return arr;
}

// TODO Remove or comment if tests pass (move the comments related to the function call here
// as well)
auto rstrip_excessive_free(std::string_view str) -> std::string_view
{
str = util::rstrip(str);
str = util::remove_suffix(str, specs::GlobSpec::free_pattern);
str = util::rstrip(str);
for (const auto& suffix : sorted_suffix(specs::VersionSpec::all_free_strs))
{
str = util::remove_suffix(str, suffix);
}
str = util::rstrip(str);
return str;
}
// Single dependency with only name constraint often end up looking like
// ``python =* *`` so `rstrip_excessive_free` was used to strip all this.
// Best would be to handle this with a richer NamedList that contains
// ``VersionSpecs`` to avoid flaky reliance on string modification.

// As `rstrip_excessive_free` side effect was to strip `*` from a regex,
// (which is not wanted and confusing when trying to understand the
// unsolvability problems), it is not used anymore on `vers_builds_trunc`.
// But we still keep it uncommented for a while (in case we need to
// restore it later).
// auto rstrip_excessive_free(std::string_view str) -> std::string_view
// {
// str = util::rstrip(str);
// str = util::remove_suffix(str, specs::GlobSpec::free_pattern);
// str = util::rstrip(str);
// for (const auto& suffix : sorted_suffix(specs::VersionSpec::all_free_strs))
// {
// str = util::remove_suffix(str, suffix);
// }
// str = util::rstrip(str);
// return str;
// }

void TreeExplainer::write_pkg_dep(const TreeNode& tn)
{
Expand All @@ -1350,10 +1358,6 @@ namespace mamba::solver
}
else
{
// Single dependency with only name constraint often end up looking like
// ``python =* *`` so we strip all this.
// Best would be to handle this with a richer NamedList that contains
// ``VersionSpecs`` to avoid flaky reliance on string modification.
const auto relevant_vers_builds_trunc = vers_builds_trunc;
if (relevant_vers_builds_trunc.empty())
{
Expand Down

0 comments on commit ebcd215

Please sign in to comment.