Skip to content

Commit

Permalink
implement Linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Sep 28, 2024
1 parent 2eaf647 commit 63cd1cb
Show file tree
Hide file tree
Showing 7 changed files with 467 additions and 330 deletions.
3 changes: 3 additions & 0 deletions crates/rattler_menuinst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ unicode-normalization = "0.1.24"
regex.workspace = true
tempfile.workspace = true
fs-err = "2.11.0"
xmltree = "0.11.0"
which = "6.0.3"
shell-words = "1.1.0"

[target.'cfg(target_os = "windows")'.dependencies]
winapi = "0.3.9"
Expand Down
13 changes: 8 additions & 5 deletions crates/rattler_menuinst/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ use rattler_conda_types::Platform;

mod linux;
mod macos;
#[cfg(target_os = "windows")]
mod windows;
mod render;
mod schema;
#[cfg(target_os = "windows")]
mod windows;

pub mod slugify;
pub use slugify::slugify;

pub mod utils;

#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum MenuMode {
System,
User,
Expand All @@ -34,6 +34,9 @@ pub enum MenuInstError {
PlistError(#[from] plist::Error),
#[error("Failed to sign plist: {0}")]
SigningFailed(String),

#[error("XML Error: {0}")]
XmlError(#[from] xmltree::Error),
}

// Install menu items from a given schema file
Expand All @@ -52,7 +55,7 @@ pub fn install_menuitems(
let mut linux_item = item.platforms.linux.clone().unwrap();
let base_item = linux_item.base.merge_parent(&item);
linux_item.base = base_item;
linux::install_menu_item(linux_item, MenuMode::System)?;
linux::install_menu_item(linux_item, MenuMode::User)?;
} else if item.platforms.osx.is_some() && platform.is_osx() {
let mut macos_item = item.platforms.osx.clone().unwrap();
let base_item = macos_item.base.merge_parent(&item);
Expand Down Expand Up @@ -88,7 +91,7 @@ pub mod test {
let prefix = std::fs::canonicalize(prefix).unwrap();
println!("prefix: {:?}", prefix);
let base_prefix = PathBuf::from("/Users/jaidevd/miniconda3");
let platform = Platform::OsxArm64;
let platform = Platform::Linux64;

install_menuitems(&schema_path, &prefix, &base_prefix, &platform).unwrap();
}
Expand Down
Loading

0 comments on commit 63cd1cb

Please sign in to comment.