fix up match spec handling for certain edge cases

This commit is contained in:
Wolf Vollprecht 2020-06-05 10:21:15 +02:00
parent 1ac8cc8539
commit 96207bfd5c
4 changed files with 22 additions and 7 deletions

View File

@ -53,10 +53,7 @@ def mamba_install(prefix, specs, args, env, *_, **kwargs):
channel_json.append((chan, subdir, priority, subpriority))
specs = [MatchSpec(s) for s in specs]
mamba_solve_specs = [s.conda_build_form() for s in specs]
print("\n\nLooking for: {}\n\n".format(mamba_solve_specs))
print("\n\nLooking for: {}\n\n".format(specs))
solver_options = [(api.SOLVER_FLAG_ALLOW_DOWNGRADE, 1)]
@ -69,7 +66,7 @@ def mamba_install(prefix, specs, args, env, *_, **kwargs):
repos.append(repo)
solver = api.Solver(pool, solver_options)
solver.add_jobs(mamba_solve_specs, api.SOLVER_INSTALL)
solver.add_jobs(specs, api.SOLVER_INSTALL)
success = solver.solve()
if not success:
print(solver.problems_to_str())

View File

@ -147,6 +147,11 @@ namespace mamba
// if 'subdir' in brackets:
// subdir = brackets.pop('subdir')
// support faulty conda matchspecs such as `libblas=[build=*mkl]`, which is the repr of `libblas=*=*mkl`
if (spec_str.back() == '=')
{
spec_str.push_back('*');
}
// TODO This is #6 of the spec parsing -- we still need to port the others!
static std::regex version_build_re("([^ =<>!~]+)?([><!=~ ].+)?");
std::smatch vb_match;
@ -323,9 +328,16 @@ namespace mamba
{
res << "=" + version.substr(0, version.size() - 2);
}
else if (ends_with(version, "*"))
else if (version.back() == '*')
{
res << "=" + version.substr(0, version.size() - 1);
if (version.size() == 1)
{
res << "=*";
}
else
{
res << "=" + version.substr(0, version.size() - 1);
}
}
else if (starts_with(version, "=="))
{

View File

@ -4,3 +4,4 @@ channels:
dependencies:
- python
- beautifulsoup4
- libblas=*=*openblas

View File

@ -138,6 +138,11 @@ namespace mamba
EXPECT_EQ(ms.conda_build_form(), "foo 1.0 2");
EXPECT_EQ(ms.str(), "foo==1.0=2");
}
{
MatchSpec ms("libblas=*=*mkl");
EXPECT_EQ(ms.conda_build_form(), "libblas * *mkl");
// EXPECT_EQ(ms.str(), "foo==1.0=2");
}
}
TEST(history, user_request)