disable 'as dependency' if backend does not support it
This commit is contained in:
@@ -23,6 +23,8 @@ const SWITCHES_INSTALL: Switches = &["--sync"];
|
||||
const SWITCHES_MAKE_DEPENDENCY: Switches = &["--database", "--asdeps"];
|
||||
const SWITCHES_REMOVE: Switches = &["--remove", "--recursive"];
|
||||
|
||||
const SUPPORTS_AS_DEPENDENCY: bool = true;
|
||||
|
||||
impl Backend for Arch {
|
||||
impl_backend_constants!();
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ const SWITCHES_INSTALL: Switches = &["install"];
|
||||
const SWITCHES_MAKE_DEPENDENCY: Switches = &[]; // not needed
|
||||
const SWITCHES_REMOVE: Switches = &["remove"];
|
||||
|
||||
const SUPPORTS_AS_DEPENDENCY: bool = true;
|
||||
|
||||
impl Backend for Debian {
|
||||
impl_backend_constants!();
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ const SWITCHES_INSTALL: Switches = &["install"];
|
||||
const SWITCHES_MAKE_DEPENDENCY: Switches = &[]; // not needed
|
||||
const SWITCHES_REMOVE: Switches = &["uninstall"];
|
||||
|
||||
const SUPPORTS_AS_DEPENDENCY: bool = false;
|
||||
|
||||
impl Backend for Python {
|
||||
impl_backend_constants!();
|
||||
|
||||
|
||||
@@ -16,11 +16,14 @@ pub struct Rust {
|
||||
|
||||
const BINARY: Text = "cargo";
|
||||
const SECTION: Text = "rust";
|
||||
|
||||
const SWITCHES_INSTALL: Switches = &["install"];
|
||||
const SWITCHES_INFO: Switches = &["search", "--limit", "1"];
|
||||
const SWITCHES_MAKE_DEPENDENCY: Switches = &[];
|
||||
const SWITCHES_REMOVE: Switches = &["uninstall"];
|
||||
|
||||
const SUPPORTS_AS_DEPENDENCY: bool = false;
|
||||
|
||||
impl Backend for Rust {
|
||||
impl_backend_constants!();
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ pub trait Backend: Debug {
|
||||
}
|
||||
|
||||
fn as_any_mut(&mut self) -> &mut dyn Any;
|
||||
|
||||
fn supports_as_dependency(&self) -> bool;
|
||||
}
|
||||
|
||||
fn get_group_packages_map(
|
||||
|
||||
@@ -53,5 +53,9 @@ macro_rules! impl_backend_constants {
|
||||
fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn supports_as_dependency(&self) -> bool {
|
||||
SUPPORTS_AS_DEPENDENCY
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user