From 61ad3e4d941595f3bd5d00e0249d61fa455ea589 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Fri, 6 Sep 2019 22:10:56 +0200 Subject: [PATCH] Remove deprecated libivy/bc features --- Cargo.lock | 9 +-------- Cargo.toml | 9 ++------- src/widgets/launcher.rs | 39 --------------------------------------- 3 files changed, 3 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31e258d..6ebacb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,11 +165,6 @@ dependencies = [ "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "libivy" -version = "0.1.0" -source = "git+https://github.com/kennylevinsen/libivy.git#d906d4518a44459663b64fc9d3b2f71c2dc030c3" - [[package]] name = "libloading" version = "0.5.2" @@ -667,14 +662,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wldash" -version = "0.1.0" +version = "0.2.0" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "dbus 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "fuzzy-matcher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libivy 0.1.0 (git+https://github.com/kennylevinsen/libivy.git)", "libpulse-binding 2.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -725,7 +719,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum libdbus-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69382cb3be797cfe62ba89ac5e594a0e3022914ff44867ffbcfc03daa24eebd7" -"checksum libivy 0.1.0 (git+https://github.com/kennylevinsen/libivy.git)" = "" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum libpulse-binding 2.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7712e3c895da914d7d969475238cc43933c5c4cf7ef3654106be9db2b327cbb" "checksum libpulse-sys 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "67df96705dc149577155690c05e067334d1d8a62bcac1a1611ef28eaaeb76354" diff --git a/Cargo.toml b/Cargo.toml index 1e2ff5e..a7c461d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wldash" -version = "0.1.0" +version = "0.2.0" authors = ["Kenny Levinsen "] edition = "2018" @@ -8,10 +8,6 @@ edition = "2018" lto = "fat" [features] -default = [ "rcalc" ] -ivy = [ "libivy" ] -bc = [] -rcalc = [ "rcalc_lib" ] damage_debug = [] [dependencies] @@ -28,8 +24,7 @@ libpulse-binding = { version = "2.11"} dbus = "0.6" fuzzy-matcher = "0.2" lazy_static = "1.4" -libivy = { git = "https://github.com/kennylevinsen/libivy.git", optional = true } -rcalc_lib = { version = "0.9", optional = true } +rcalc_lib = { version = "0.9" } rust-ini = "0.13" shlex = "0.1" serde_json = "1.0" diff --git a/src/widgets/launcher.rs b/src/widgets/launcher.rs index 09960d2..e6cfe12 100644 --- a/src/widgets/launcher.rs +++ b/src/widgets/launcher.rs @@ -164,51 +164,12 @@ impl Launcher { } } -#[cfg(feature = "ivy")] -fn calc(s: &str) -> Result { - libivy::eval(s) -} - -#[cfg(feature = "rcalc")] fn calc(s: &str) -> Result { rcalc_lib::parse::eval(s, &mut rcalc_lib::parse::CalcState::new()) .map(|x| format!("{}", x).to_string()) .map_err(|x| format!("{}", x).to_string()) } -#[cfg(feature = "bc")] -fn calc(s: &str) -> Result { - use std::io::Write; - let mut child = std::process::Command::new("bc") - .stdin(std::process::Stdio::piped()) - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .arg("--mathlib") - .spawn() - .map_err(|_| "bc not available".to_string())?; - { - let stdin = child.stdin.as_mut().unwrap(); - stdin - .write_all(s.as_bytes()) - .map_err(|_| "unable to write to stdin".to_string())?; - stdin - .write_all("\n".as_bytes()) - .map_err(|_| "unable to write to stdin".to_string())?; - } - let output = child - .wait_with_output() - .map_err(|_| "unable to run bc".to_string())?; - Ok(std::str::from_utf8(&output.stdout) - .map_err(|_| "unable to read from bc")? - .trim() - .to_string()) -} - -#[cfg(not(any(feature = "ivy", feature = "bc", feature = "rcalc")))] -fn calc(_s: &str) -> Result { - Err("no calculator implementation available".to_string()) -} - fn wlcopy(s: &str) -> Result<(), String> { let mut child = std::process::Command::new("wl-copy") .stdin(std::process::Stdio::null())