mirror of https://github.com/mamba-org/mamba.git
fix up match spec handling for certain edge cases
This commit is contained in:
parent
1ac8cc8539
commit
96207bfd5c
|
@ -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())
|
||||
|
|
|
@ -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, "=="))
|
||||
{
|
||||
|
|
1
test.yml
1
test.yml
|
@ -4,3 +4,4 @@ channels:
|
|||
dependencies:
|
||||
- python
|
||||
- beautifulsoup4
|
||||
- libblas=*=*openblas
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue