mirror of https://github.com/mamba-org/mamba.git
fix fuzzy case with no ., add multi install
This commit is contained in:
parent
9b7be4a47a
commit
90a47c99f5
|
@ -10,7 +10,8 @@ import time
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
channels = ['conda-forge', 'r', 'anaconda']
|
||||
what_to_get = "opencv ==3.4.2"
|
||||
# what_to_get = ["opencv ==3.4.2"]
|
||||
what_to_get = ["xtensor-r", "r-base ==3.5.1"]
|
||||
|
||||
url_template = 'https://conda.anaconda.org/{}/linux-64/repodata.json.bz2'
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ void installed_packages(Repo* repo, ParsedJson::iterator &i) {
|
|||
|
||||
std::string solve(std::vector<std::string> repos,
|
||||
std::string installed,
|
||||
std::string look_for)
|
||||
std::vector<std::string> jobs)
|
||||
{
|
||||
Pool* pool = pool_create();
|
||||
global_pool = pool;
|
||||
|
@ -244,7 +244,7 @@ std::string solve(std::vector<std::string> repos,
|
|||
}
|
||||
ParsedJson::iterator pjh(pj);
|
||||
parse_repo(pjh, repo);
|
||||
std::cout << "Packages in " << fn << ": " << repo->nsolvables << std::endl;
|
||||
std::cout << repo->nsolvables << " packages in " << fn << std::endl;
|
||||
repo_internalize(repo);
|
||||
}
|
||||
|
||||
|
@ -252,18 +252,23 @@ std::string solve(std::vector<std::string> repos,
|
|||
Solver* solvy = solver_create(global_pool);
|
||||
solver_set_flag(solvy, SOLVER_FLAG_ALLOW_DOWNGRADE, 1);
|
||||
|
||||
std::cout << "ALLOW DOWNGRADE? : " << solver_get_flag(solvy, SOLVER_FLAG_ALLOW_DOWNGRADE);
|
||||
std::cout << "Allowing downgrade: " << solver_get_flag(solvy, SOLVER_FLAG_ALLOW_DOWNGRADE) << std::endl;
|
||||
|
||||
std::cout << "\nCreating the solver." << std::endl;
|
||||
std::cout << "Creating the solver...\n" << std::endl;
|
||||
|
||||
Queue q;
|
||||
queue_init(&q);
|
||||
int rel = parse_to_relation(look_for, pool);
|
||||
std::cout << "Dep 2 str: " << pool_dep2str(pool, rel);
|
||||
for (const auto& job : jobs)
|
||||
{
|
||||
int rel = parse_to_relation(job, pool);
|
||||
std::cout << "Job: " << pool_dep2str(pool, rel) << std::endl;;
|
||||
queue_push2(&q, SOLVER_INSTALL | SOLVER_SOLVABLE_NAME, rel);
|
||||
}
|
||||
|
||||
queue_push2(&q, SOLVER_INSTALL | SOLVER_SOLVABLE_NAME, rel);
|
||||
std::cout << "\n";
|
||||
|
||||
solver_solve(solvy, &q);
|
||||
|
||||
Transaction* transy = solver_create_transaction(solvy);
|
||||
int cnt = solver_problem_count(solvy);
|
||||
Queue problem_queue;
|
||||
|
@ -273,7 +278,11 @@ std::string solve(std::vector<std::string> repos,
|
|||
for (int i = 1; i <= cnt; i++)
|
||||
{
|
||||
queue_push(&problem_queue, i);
|
||||
std::cout << "PROBLEM: " << solver_problem2str(solvy, i);
|
||||
std::cout << "Problem: " << solver_problem2str(solvy, i) << std::endl;
|
||||
}
|
||||
if (cnt > 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
transaction_print(transy);
|
||||
|
@ -284,7 +293,7 @@ std::string solve(std::vector<std::string> repos,
|
|||
cut = transaction_installedresult(transy, &q2);
|
||||
queue_truncate(&q2, cut);
|
||||
|
||||
std::cout << "Solution: " << std::endl;
|
||||
std::cout << "Solution: \n" << std::endl;
|
||||
|
||||
std::vector<std::string> to_install;
|
||||
for (int i = 0; i < q2.count; ++i)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
<%
|
||||
cfg['compiler_args'] = ['-O0', '-std=c++17', '-march=native']
|
||||
cfg['compiler_args'] = ['-O3', '-std=c++17', '-march=native']
|
||||
cfg['libraries'] = ['solv']
|
||||
setup_pybind11(cfg)
|
||||
%>
|
||||
|
@ -8,6 +8,8 @@ setup_pybind11(cfg)
|
|||
|
||||
#include "parsing.hpp"
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
static Pool* gb_pool;
|
||||
|
||||
PYBIND11_MODULE(parsing, m) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -166,6 +167,11 @@ Id get_fuzzy_relation(Id name_id, const std::string_view& vnumber, Pool* pool)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (idx_front == -1)
|
||||
{
|
||||
auto* end_ptr = const_cast<char*>(&vnumber[idx_back]);
|
||||
lversion = std::strtoul(&vnumber[idx_front + 1], &end_ptr, 10);
|
||||
}
|
||||
|
||||
// lower_version = vnumber[0] -> vnumber[idx_back];
|
||||
std::string higher_version(vnumber.begin(), vnumber.begin() + idx_front + 1);
|
||||
|
|
|
@ -12,7 +12,7 @@ setup_pybind11(cfg)
|
|||
#include <pybind11/stl.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
|
||||
PYBIND11_MODULE(interface, m) {
|
||||
m.def("solve", &solve);
|
||||
}
|
Loading…
Reference in New Issue