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

maint: Move solver::libsolv::RepoInfo to solver::RepoInfo #3380

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
python: Adapt bindings accordingly
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Oct 14, 2024
commit fb917935e064de3f4f5ea24b8a76eb6b52101865
3 changes: 1 addition & 2 deletions libmambapy/src/libmambapy/bindings/legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,7 @@ bind_submodule_impl(pybind11::module_ m)
py::class_<SubdirData>(m, "SubdirData")
.def(
"create_repo",
[](SubdirData& self, Context& context, solver::libsolv::Database& db
) -> solver::libsolv::RepoInfo
[](SubdirData& self, Context& context, solver::libsolv::Database& db) -> solver::RepoInfo
{
deprecated("Use libmambapy.load_subdir_in_database instead", "2.0");
return extract(load_subdir_in_database(context, db, self));
Expand Down
11 changes: 11 additions & 0 deletions libmambapy/src/libmambapy/bindings/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <pybind11/stl_bind.h>

#include "mamba/solver/problems_graph.hpp"
#include "mamba/solver/repo_info.hpp"
#include "mamba/solver/request.hpp"
#include "mamba/solver/solution.hpp"

Expand Down Expand Up @@ -507,5 +508,15 @@ namespace mambapy
}
)
.def("tree_message", &problem_tree_msg, py::arg("format") = ProblemsMessageFormat());

py::class_<RepoInfo>(m, "RepoInfo")
.def_property_readonly("id", &RepoInfo::id)
.def_property_readonly("name", &RepoInfo::name)
.def_property_readonly("priority", &RepoInfo::priority)
.def("package_count", &RepoInfo::package_count)
.def(py::self == py::self)
.def(py::self != py::self)
.def("__copy__", &copy<RepoInfo>)
.def("__deepcopy__", &deepcopy<RepoInfo>, py::arg("memo"));
}
}
12 changes: 1 addition & 11 deletions libmambapy/src/libmambapy/bindings/solver_libsolv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,6 @@ namespace mambapy
.def("__copy__", &copy<RepodataOrigin>)
.def("__deepcopy__", &deepcopy<RepodataOrigin>, py::arg("memo"));

py::class_<RepoInfo>(m, "RepoInfo")
.def_property_readonly("id", &RepoInfo::id)
.def_property_readonly("name", &RepoInfo::name)
.def_property_readonly("priority", &RepoInfo::priority)
.def("package_count", &RepoInfo::package_count)
.def(py::self == py::self)
.def(py::self != py::self)
.def("__copy__", &copy<RepoInfo>)
.def("__deepcopy__", &deepcopy<RepoInfo>, py::arg("memo"));

py::class_<Database>(m, "Database")
.def(py::init<specs::ChannelResolveParams>(), py::arg("channel_params"))
.def("set_logger", &Database::set_logger, py::call_guard<py::gil_scoped_acquire>())
Expand Down Expand Up @@ -169,7 +159,7 @@ namespace mambapy
.def("package_count", &Database::package_count)
.def(
"packages_in_repo",
[](const Database& db, RepoInfo repo)
[](const Database& db, solver::RepoInfo repo)
{
// TODO(C++20): When Database function are refactored to use range, take the
// opportunity here to make a Python iterator to avoid large alloc.
Expand Down