Skip to content

Commit

Permalink
Add UnresolvedChannel::is_package
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Mar 5, 2024
1 parent d7e5407 commit 913cba0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions libmamba/include/mamba/specs/unresolved_channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ namespace mamba::specs
[[nodiscard]] auto platform_filters() && -> platform_set;
auto clear_platform_filters() -> platform_set;

[[nodiscard]] auto is_package() const -> bool;

[[nodiscard]] auto str() const -> std::string;

private:
Expand Down
4 changes: 1 addition & 3 deletions libmamba/src/specs/match_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,7 @@ namespace mamba::specs
{
if (const auto& chan = channel(); chan.has_value())
{
auto type = chan->type();
using Type = typename UnresolvedChannel::Type;
return (type == Type::PackageURL) || (type == Type::PackagePath);
return chan->is_package();
}
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions libmamba/src/specs/unresolved_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ namespace mamba::specs
return std::exchange(m_platform_filters, {});
}

auto UnresolvedChannel::is_package() const -> bool
{
return (type() == Type::PackageURL) || (type() == Type::PackagePath);
}

auto UnresolvedChannel::str() const -> std::string
{
return fmt::format("{}", *this);
Expand Down

0 comments on commit 913cba0

Please sign in to comment.