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

added support for empty lines in dependency file in txt format. micro… #2812

Merged
merged 7 commits into from
Sep 13, 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
8 changes: 5 additions & 3 deletions libmamba/src/core/match_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ namespace mamba

void MatchSpec::parse(ChannelContext& channel_context)
{
LOG_INFO << "Parsing MatchSpec " << spec;
std::string spec_str = spec;

if (spec_str.empty())
{
return;
}
LOG_INFO << "Parsing MatchSpec " << spec;
std::size_t idx = spec_str.find('#');
if (idx != std::string::npos)
{
Expand Down Expand Up @@ -303,7 +306,6 @@ namespace mamba

std::string MatchSpec::conda_build_form() const
{
assert(!name.empty());
std::stringstream res;
res << name;
if (!version.empty())
Expand Down
5 changes: 5 additions & 0 deletions libmamba/src/core/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ namespace mamba
MatchSpec ms{ job, m_pool.channel_context() };
int job_type = job_flag & SOLVER_JOBMASK;

if (ms.conda_build_form().empty())
{
return;
}

if (job_type & SOLVER_INSTALL)
{
m_install_specs.emplace_back(job, m_pool.channel_context());
Expand Down
5 changes: 5 additions & 0 deletions libmamba/tests/src/core/test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ namespace mamba
CHECK_EQ(ms.version, "0.12.3");
CHECK_EQ(ms.name, "xtensor");
}
{
MatchSpec ms("", channel_context);
CHECK_EQ(ms.version, "");
CHECK_EQ(ms.name, "");
}
{
MatchSpec ms("ipykernel", channel_context);
CHECK_EQ(ms.version, "");
Expand Down
12 changes: 12 additions & 0 deletions libmamba/tests/src/core/test_satisfiability_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ TEST_CASE("Test create_problem utility")
REQUIRE(solved);
}

TEST_CASE("Test empty specs")
{
ChannelContext channel_context{ mambatests::context() };
auto solver = create_problem(
channel_context,
std::array{ mkpkg("foo", "0.1.0", {}), mkpkg("", "", {}) },
{ "foo" }
);
const auto solved = solver.try_solve();
REQUIRE(solved);
}

namespace
{
auto create_basic_conflict(ChannelContext& channel_context) -> MSolver
Expand Down