From 9a35b99971556cb93e8be68c7da8fa9e90f27f90 Mon Sep 17 00:00:00 2001 From: Benedikt Terhechte Date: Sat, 18 Dec 2021 22:58:43 +0100 Subject: [PATCH] Cleanup Dependencies (#12) * Moved deps into ps-core and `pub use` exported them so they're only in one place * Updated Version Numbers --- Cargo.lock | 64 ++----------------- LICENSE.md | 7 ++ README.md | 7 +- postsack-native/Cargo.toml | 2 +- postsack-web/Cargo.toml | 2 +- ps-core/Cargo.toml | 9 +-- ps-core/src/lib.rs | 10 ++- ps-database/Cargo.toml | 10 +-- ps-database/src/conversion.rs | 4 +- ps-database/src/db.rs | 15 ++--- ps-gui/Cargo.toml | 25 ++------ ps-gui/src/app_state/error.rs | 2 +- ps-gui/src/app_state/import.rs | 4 +- ps-gui/src/app_state/main.rs | 2 +- ps-gui/src/app_state/mod.rs | 2 +- ps-gui/src/mail_panel.rs | 2 +- ps-gui/src/navigation_bar.rs | 2 +- ps-gui/src/platform/linux.rs | 2 +- ps-gui/src/platform/macos.rs | 2 +- ps-gui/src/platform/windows.rs | 2 +- ps-gui/src/segmentation_bar.rs | 2 +- ps-gui/src/textures.rs | 4 ++ ps-gui/src/widgets/filter_panel.rs | 2 +- ps-gui/src/widgets/rectangles.rs | 2 +- ps-importer/Cargo.toml | 11 +--- .../src/formats/apple_mail/filesystem.rs | 3 +- ps-importer/src/formats/apple_mail/mail.rs | 2 +- ps-importer/src/formats/gmailbackup/meta.rs | 9 ++- .../src/formats/gmailbackup/raw_email.rs | 3 +- ps-importer/src/formats/mbox/mod.rs | 4 +- ps-importer/src/formats/mod.rs | 2 +- ps-importer/src/formats/shared/database.rs | 3 +- ps-importer/src/formats/shared/filesystem.rs | 4 +- ps-importer/src/formats/shared/parse.rs | 6 +- ps-importer/src/lib.rs | 4 +- 35 files changed, 83 insertions(+), 153 deletions(-) create mode 100644 LICENSE.md diff --git a/Cargo.lock b/Cargo.lock index b30b412..a6cde63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,15 +50,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - [[package]] name = "andrew" version = "0.3.1" @@ -1566,7 +1557,7 @@ dependencies = [ [[package]] name = "postsack" -version = "0.2.0" +version = "1.0.0" dependencies = [ "ps-core", "ps-database", @@ -1576,7 +1567,7 @@ dependencies = [ [[package]] name = "postsack-web" -version = "0.2.0" +version = "1.0.0" dependencies = [ "console_error_panic_hook", "ps-core", @@ -1627,24 +1618,20 @@ dependencies = [ [[package]] name = "ps-core" -version = "0.2.0" +version = "1.0.0" dependencies = [ "chrono", "crossbeam-channel", "eyre", - "flate2", "getrandom", "lru", "once_cell", "rand", - "regex", "rsql_builder", "serde", "serde_json", - "shellexpand", "strum", "strum_macros", - "thiserror", "tracing", "tracing-subscriber", "treemap", @@ -1652,65 +1639,43 @@ dependencies = [ [[package]] name = "ps-database" -version = "0.2.0" +version = "1.0.0" dependencies = [ - "chrono", - "eyre", "ps-core", - "rsql_builder", "rusqlite", - "serde", - "serde_json", - "thiserror", - "tracing", - "tracing-subscriber", ] [[package]] name = "ps-gui" -version = "0.2.0" +version = "1.0.0" dependencies = [ "chrono", "cocoa", - "crossbeam-channel", "eframe", - "eyre", - "getrandom", "image", "num-format", "objc", "once_cell", "ps-core", "ps-importer", - "rand", "shellexpand", - "thiserror", "tinyfiledialogs", - "tracing", - "tracing-subscriber", ] [[package]] name = "ps-importer" -version = "0.2.0" +version = "1.0.0" dependencies = [ - "chrono", "email-parser", "emlx", - "eyre", "flate2", "mbox-reader", "once_cell", "ps-core", - "rand", "rayon", - "regex", "serde", "serde_json", "shellexpand", - "thiserror", - "tracing", - "tracing-subscriber", "walkdir", ] @@ -1835,23 +1800,6 @@ dependencies = [ "redox_syscall", ] -[[package]] -name = "regex" -version = "1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - [[package]] name = "rsql_builder" version = "0.1.2" diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e2045bc --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +Copyright 2017 Cargo-Bundle developers + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index d4f980d..442ca47 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,5 @@ # Postsack -# What can go into core (web compatible!)? -- database only as trait -- importer only as trait - - ## Provides a high level visual overview of swaths of email ### Performance @@ -14,6 +9,8 @@ Update: It currently parses 632115 emails in ~56 seconds, so roughly `11.000` em ## Open Issues +- [ ] check for unused dependencies in each crate +- [ ] `pub use ...` some deps in core so that they don't need to be re-imported - [ ] check the feature.lru to see if it compiles without LRU - [ ] build static linux binary via docker: Via Github Actions? - [ ] try to build a static windows binary: Via Github Actions? diff --git a/postsack-native/Cargo.toml b/postsack-native/Cargo.toml index ee3c190..b81a567 100644 --- a/postsack-native/Cargo.toml +++ b/postsack-native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "postsack" -version = "0.2.0" +version = "1.0.0" edition = "2021" description = "Provides a high level visual overview of swaths of email" diff --git a/postsack-web/Cargo.toml b/postsack-web/Cargo.toml index a4bef60..39cc0dd 100644 --- a/postsack-web/Cargo.toml +++ b/postsack-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "postsack-web" -version = "0.2.0" +version = "1.0.0" edition = "2021" description = "Provides a high level visual overview of swaths of email" diff --git a/ps-core/Cargo.toml b/ps-core/Cargo.toml index cf5ff30..995776d 100644 --- a/ps-core/Cargo.toml +++ b/ps-core/Cargo.toml @@ -1,16 +1,12 @@ [package] name = "ps-core" -version = "0.2.0" +version = "1.0.0" edition = "2021" -description = "Provides a high level visual overview of swaths of email" [dependencies] eyre = "0.6.5" -thiserror = "1.0.29" tracing = "0.1.29" tracing-subscriber = "0.3.0" -regex = "1.5.3" -flate2 = "1.0.22" once_cell = "1.8.0" chrono = {version = "0.4.19", features = ["wasmbind"]} serde_json = "1.0.70" @@ -26,6 +22,3 @@ lru = { version = "0.7.0"} [target."cfg(target_arch = \"wasm32\")".dependencies] # https://docs.rs/getrandom/latest/getrandom/#webassembly-support getrandom = { version = "0.2", features = ["js"] } - -[target."cfg(not(target_arch = \"wasm32\"))".dependencies] -shellexpand = "2.1.0" diff --git a/ps-core/src/lib.rs b/ps-core/src/lib.rs index 75c68df..4830697 100644 --- a/ps-core/src/lib.rs +++ b/ps-core/src/lib.rs @@ -8,13 +8,17 @@ pub use database::database_like::{DatabaseLike, DatabaseQuery}; pub use database::db_message::DBMessage; pub use database::query::{Field, Filter, OtherQuery, Query, ValueField, AMOUNT_FIELD_NAME}; pub use database::query_result::{QueryResult, QueryRow}; +pub use importer::{Importerlike, Message, MessageReceiver, MessageSender}; pub use types::{Config, EmailEntry, EmailMeta, FormatType}; +// Re-Export some dependencies so they don't +// need to be listed again in other Cargo tomls +pub use chrono; pub use crossbeam_channel; pub use eyre; -pub use importer::{Importerlike, Message, MessageReceiver, MessageSender}; - -pub use serde_json::Value; +pub use rand; +pub use serde_json::{self, Value}; +pub use tracing; // Tracing diff --git a/ps-database/Cargo.toml b/ps-database/Cargo.toml index f548333..869d8c5 100644 --- a/ps-database/Cargo.toml +++ b/ps-database/Cargo.toml @@ -1,16 +1,8 @@ [package] name = "ps-database" -version = "0.2.0" +version = "1.0.0" edition = "2021" [dependencies] -eyre = "0.6.5" -thiserror = "1.0.29" -tracing = "0.1.29" -tracing-subscriber = "0.3.0" rusqlite = {version = "0.26.1", features = ["chrono", "trace", "serde_json", "bundled"]} -chrono = {version = "0.4.19", features = ["wasmbind"]} -serde_json = "1.0.70" -serde = { version = "1.0.130", features = ["derive"]} -rsql_builder = "0.1.2" ps-core = { path = "../ps-core" } \ No newline at end of file diff --git a/ps-database/src/conversion.rs b/ps-database/src/conversion.rs index 6412d8c..3971a3e 100644 --- a/ps-database/src/conversion.rs +++ b/ps-database/src/conversion.rs @@ -1,9 +1,9 @@ use std::collections::HashMap; use std::convert::TryInto; -use eyre::{bail, eyre, Result}; +use ps_core::eyre::{bail, eyre, Result}; +use ps_core::Value; use rusqlite::{self, types, Row}; -use serde_json::Value; use ps_core::{EmailMeta, Field, QueryResult, ValueField, AMOUNT_FIELD_NAME}; diff --git a/ps-database/src/db.rs b/ps-database/src/db.rs index aa33235..1b311d4 100644 --- a/ps-database/src/db.rs +++ b/ps-database/src/db.rs @@ -1,5 +1,3 @@ -use chrono::Datelike; -use eyre::{bail, Report, Result}; use rusqlite::{self, params, Connection, Statement}; use std::path::PathBuf; @@ -7,6 +5,10 @@ use std::{collections::HashMap, path::Path, thread::JoinHandle}; use super::sql::*; use super::{value_from_field, RowConversion}; +use ps_core::chrono::Datelike; +use ps_core::eyre::{self, bail, Report, Result}; +use ps_core::tracing; +use ps_core::Value; use ps_core::{ crossbeam_channel::{unbounded, Sender}, Config, DBMessage, DatabaseLike, DatabaseQuery, EmailEntry, OtherQuery, Query, QueryResult, @@ -187,7 +189,7 @@ impl Database { Ok(()) } - fn select_config_fields(&self) -> Result> { + fn select_config_fields(&self) -> Result> { let connection = match &self.connection { Some(n) => n, None => bail!("No connection to database available in query"), @@ -196,10 +198,7 @@ impl Database { let mut query_results = HashMap::new(); let mut rows = stmt.query([])?; while let Some(row) = rows.next()? { - let (k, v) = match ( - row.get::<_, String>("key"), - row.get::<_, serde_json::Value>("value"), - ) { + let (k, v) = match (row.get::<_, String>("key"), row.get::<_, Value>("value")) { (Ok(k), Ok(v)) => (k, v), (a, b) => { tracing::error!("Invalid row data. Missing fields key and or value:\nkey: {:?}\nvalue: {:?}\n", a, b); @@ -211,7 +210,7 @@ impl Database { Ok(query_results) } - fn insert_config_fields(&self, fields: HashMap) -> Result<()> { + fn insert_config_fields(&self, fields: HashMap) -> Result<()> { let connection = match &self.connection { Some(n) => n, None => bail!("No connection to database available in query"), diff --git a/ps-gui/Cargo.toml b/ps-gui/Cargo.toml index 409195b..b6aa5b8 100644 --- a/ps-gui/Cargo.toml +++ b/ps-gui/Cargo.toml @@ -1,34 +1,23 @@ [package] name = "ps-gui" -version = "0.2.0" +version = "1.0.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -eyre = "0.6.5" -thiserror = "1.0.29" -tracing = "0.1.29" -tracing-subscriber = "0.3.0" -once_cell = "1.8.0" -crossbeam-channel = "0.5.1" eframe = "0.15.0" num-format = "0.4.0" -rand = "0.8.4" chrono = {version = "0.4.19", features = ["wasmbind"]} ps-core = { path = "../ps-core" } +once_cell = "1.9.0" -[target."cfg(target_os = \"macos\")".dependencies.cocoa] -version = "0.24" -[target."cfg(target_os = \"macos\")".dependencies.objc] -version = "0.2.7" +[target."cfg(target_os = \"macos\")".dependencies] +image = { version = "0.23", default-features = false, features = ["png"] } +cocoa = "0.24" +objc = "0.2.7" [target."cfg(not(target_arch = \"wasm32\"))".dependencies] ps-importer = { path = "../ps-importer" } shellexpand = "2.1.0" -tinyfiledialogs = "3.0" -image = { version = "0.23", default-features = false, features = ["png"] } - -[target."cfg(target_arch = \"wasm32\")".dependencies] -# https://docs.rs/getrandom/latest/getrandom/#webassembly-support -getrandom = { version = "0.2", features = ["js"] } +tinyfiledialogs = "3.0" \ No newline at end of file diff --git a/ps-gui/src/app_state/error.rs b/ps-gui/src/app_state/error.rs index d715dbd..7c558f3 100644 --- a/ps-gui/src/app_state/error.rs +++ b/ps-gui/src/app_state/error.rs @@ -5,7 +5,7 @@ use eframe::{ use super::Textures; use super::{StateUIAction, StateUIVariant}; -use ps_core::Config; +use ps_core::{eyre, Config}; pub struct ErrorUI { /// The error to display diff --git a/ps-gui/src/app_state/import.rs b/ps-gui/src/app_state/import.rs index 32f1cf7..1a5ffbd 100644 --- a/ps-gui/src/app_state/import.rs +++ b/ps-gui/src/app_state/import.rs @@ -3,8 +3,8 @@ use std::thread::JoinHandle; use eframe::egui::epaint::Shadow; use eframe::egui::{self, Color32, Pos2, Rect, Response, Stroke}; -use eyre::Result; -use rand::seq::SliceRandom; +use ps_core::eyre::{self, Result}; +use ps_core::rand::{self, seq::SliceRandom}; use super::super::platform::platform_colors; use super::super::widgets::background::{shadow_background, AnimatedBackground}; diff --git a/ps-gui/src/app_state/main.rs b/ps-gui/src/app_state/main.rs index a7eabf7..ed53f1d 100644 --- a/ps-gui/src/app_state/main.rs +++ b/ps-gui/src/app_state/main.rs @@ -1,5 +1,5 @@ use eframe::egui::{self, Stroke}; -use eyre::{Report, Result}; +use ps_core::eyre::{Report, Result}; use super::super::widgets::{FilterState, Spinner}; use super::Textures; diff --git a/ps-gui/src/app_state/mod.rs b/ps-gui/src/app_state/mod.rs index d5bbbce..d5bd790 100644 --- a/ps-gui/src/app_state/mod.rs +++ b/ps-gui/src/app_state/mod.rs @@ -8,9 +8,9 @@ use std::path::PathBuf; pub use super::textures::Textures; use eframe::egui::{self}; pub use error::ErrorUI; -use eyre::Report; pub use import::ImporterUI; pub use main::{MainUI, UIState}; +use ps_core::eyre::Report; pub use startup::StartupUI; use ps_core::{Config, DatabaseLike, FormatType}; diff --git a/ps-gui/src/mail_panel.rs b/ps-gui/src/mail_panel.rs index ebd5a29..b2dfc22 100644 --- a/ps-gui/src/mail_panel.rs +++ b/ps-gui/src/mail_panel.rs @@ -1,6 +1,6 @@ use chrono::prelude::*; use eframe::egui::{self, Widget}; -use eyre::Report; +use ps_core::eyre::Report; use ps_core::{model::items, model::Engine, Field, QueryRow}; use super::widgets::Table; diff --git a/ps-gui/src/navigation_bar.rs b/ps-gui/src/navigation_bar.rs index a072a03..3ff242f 100644 --- a/ps-gui/src/navigation_bar.rs +++ b/ps-gui/src/navigation_bar.rs @@ -1,6 +1,6 @@ use eframe::egui::{self, Color32, Label, Widget}; -use eyre::Report; use num_format::{Locale, ToFormattedString}; +use ps_core::eyre::Report; use ps_core::model::Engine; use super::app_state::UIState; diff --git a/ps-gui/src/platform/linux.rs b/ps-gui/src/platform/linux.rs index b689de5..ac364cf 100644 --- a/ps-gui/src/platform/linux.rs +++ b/ps-gui/src/platform/linux.rs @@ -1,7 +1,7 @@ #![cfg(target_os = "linux")] use eframe::egui::{self, Color32}; -use eyre::Result; +use ps_core::eyre::Result; use super::{PlatformColors, Theme}; diff --git a/ps-gui/src/platform/macos.rs b/ps-gui/src/platform/macos.rs index 1695682..d45d78a 100644 --- a/ps-gui/src/platform/macos.rs +++ b/ps-gui/src/platform/macos.rs @@ -8,7 +8,7 @@ const SYSTEM_MONO_FONT: &[u8] = include_bytes!("../fonts/mac_mono.ttc"); use cocoa; use eframe::egui::{self, Color32, FontDefinitions, FontFamily, Stroke}; -use eyre::{bail, Result}; +use ps_core::eyre::{bail, Result}; use objc::runtime::{Object, YES}; use objc::*; diff --git a/ps-gui/src/platform/windows.rs b/ps-gui/src/platform/windows.rs index d5ecfd2..2ee845a 100644 --- a/ps-gui/src/platform/windows.rs +++ b/ps-gui/src/platform/windows.rs @@ -1,7 +1,7 @@ #![cfg(target_os = "windows")] use eframe::egui::{self, Color32}; -use eyre::Result; +use ps_core::eyre::Result; use super::{PlatformColors, Theme}; diff --git a/ps-gui/src/segmentation_bar.rs b/ps-gui/src/segmentation_bar.rs index 69e5e68..2141a5d 100644 --- a/ps-gui/src/segmentation_bar.rs +++ b/ps-gui/src/segmentation_bar.rs @@ -1,5 +1,5 @@ use eframe::egui::{self, Widget}; -use eyre::Report; +use ps_core::eyre::Report; use ps_core::model::{segmentations, Engine}; pub struct SegmentationBar<'a> { diff --git a/ps-gui/src/textures.rs b/ps-gui/src/textures.rs index 7f9b10b..7cd944e 100644 --- a/ps-gui/src/textures.rs +++ b/ps-gui/src/textures.rs @@ -6,6 +6,10 @@ //! This is complicated by the fact that the image in question is only //! necessary on macOS and I'd rather not load it on Windows or Linux systems. +#[cfg(not(target_os = "macos"))] +use eframe::{self, epi}; + +#[cfg(target_os = "macos")] use eframe::{self, egui, epi}; #[cfg(target_os = "macos")] diff --git a/ps-gui/src/widgets/filter_panel.rs b/ps-gui/src/widgets/filter_panel.rs index 633e211..74a00ca 100644 --- a/ps-gui/src/widgets/filter_panel.rs +++ b/ps-gui/src/widgets/filter_panel.rs @@ -1,6 +1,6 @@ //! A panel to edit filters use eframe::egui::{self, vec2, Color32, Response, Widget}; -use eyre::Report; +use ps_core::eyre::Report; use ps_core::{ model::{segmentations, Engine}, diff --git a/ps-gui/src/widgets/rectangles.rs b/ps-gui/src/widgets/rectangles.rs index 66ec64e..1ff4305 100644 --- a/ps-gui/src/widgets/rectangles.rs +++ b/ps-gui/src/widgets/rectangles.rs @@ -1,8 +1,8 @@ use std::collections::hash_map::DefaultHasher; use eframe::egui::{self, epaint::Galley, Color32, Pos2, Rect, Rgba, Stroke, TextStyle, Widget}; -use eyre::Report; use num_format::{Locale, ToFormattedString}; +use ps_core::eyre::Report; use ps_core::model::{self, segmentations, Engine, Segment}; use super::super::platform::platform_colors; diff --git a/ps-importer/Cargo.toml b/ps-importer/Cargo.toml index 4899d75..324ae5c 100644 --- a/ps-importer/Cargo.toml +++ b/ps-importer/Cargo.toml @@ -1,26 +1,19 @@ [package] name = "ps-importer" -version = "0.2.0" +version = "1.0.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -eyre = "0.6.5" -thiserror = "1.0.29" -tracing = "0.1.29" -tracing-subscriber = "0.3.0" -regex = "1.5.3" flate2 = "1.0.22" once_cell = "1.8.0" email-parser = { git = "https://github.com/terhechte/email-parser", features = ["sender", "to", "in-reply-to", "date", "subject", "mime", "allow-duplicate-headers", "compatibility-fixes"]} rayon = "1.5.1" -chrono = "0.4.19" emlx = { git = "https://github.com/terhechte/emlx", features = []} walkdir = "2.3.2" mbox-reader = "0.2.0" -rand = "0.8.4" shellexpand = "2.1.0" serde_json = "1.0.70" -serde = { version = "1.0.130", features = ["derive"]} +serde = { version = "1.0.131", features = ["derive"]} ps-core = { path = "../ps-core" } \ No newline at end of file diff --git a/ps-importer/src/formats/apple_mail/filesystem.rs b/ps-importer/src/formats/apple_mail/filesystem.rs index 76d1436..e77eabd 100644 --- a/ps-importer/src/formats/apple_mail/filesystem.rs +++ b/ps-importer/src/formats/apple_mail/filesystem.rs @@ -2,11 +2,12 @@ //! recursively drill down into the appropriate folder //! until we find `emlx` files and return those. -use eyre::{eyre, Result}; use rayon::prelude::*; use walkdir::WalkDir; use super::super::shared::filesystem::emails_in; +use ps_core::eyre::{eyre, Result}; +use ps_core::tracing; use ps_core::{Config, Message, MessageSender}; use super::mail::Mail; diff --git a/ps-importer/src/formats/apple_mail/mail.rs b/ps-importer/src/formats/apple_mail/mail.rs index 8d23a3b..af5acf7 100644 --- a/ps-importer/src/formats/apple_mail/mail.rs +++ b/ps-importer/src/formats/apple_mail/mail.rs @@ -1,9 +1,9 @@ use emlx::parse_emlx; -use eyre::Result; use std::borrow::Cow; use std::path::{Path, PathBuf}; +use ps_core::eyre::Result; use ps_core::EmailMeta; use super::super::shared::parse::ParseableEmail; diff --git a/ps-importer/src/formats/gmailbackup/meta.rs b/ps-importer/src/formats/gmailbackup/meta.rs index 36d7a57..d13bbb1 100644 --- a/ps-importer/src/formats/gmailbackup/meta.rs +++ b/ps-importer/src/formats/gmailbackup/meta.rs @@ -1,10 +1,9 @@ -use chrono::prelude::*; - -use eyre::{bail, Result}; +use super::raw_email::RawEmailEntry; use serde::Deserialize; -use serde_json; -use super::raw_email::RawEmailEntry; +use ps_core::chrono::prelude::*; +use ps_core::eyre::{bail, Result}; +use ps_core::serde_json; use ps_core::EmailMeta; #[derive(Deserialize, Debug, Clone)] diff --git a/ps-importer/src/formats/gmailbackup/raw_email.rs b/ps-importer/src/formats/gmailbackup/raw_email.rs index 22c6839..75c644f 100644 --- a/ps-importer/src/formats/gmailbackup/raw_email.rs +++ b/ps-importer/src/formats/gmailbackup/raw_email.rs @@ -1,5 +1,6 @@ -use eyre::{eyre, Result}; use flate2::read::GzDecoder; +use ps_core::eyre::{eyre, Result}; +use ps_core::tracing; use std::borrow::Cow; use std::io::Read; diff --git a/ps-importer/src/formats/mbox/mod.rs b/ps-importer/src/formats/mbox/mod.rs index f109dc4..ec0ffb3 100644 --- a/ps-importer/src/formats/mbox/mod.rs +++ b/ps-importer/src/formats/mbox/mod.rs @@ -4,10 +4,10 @@ //! (or aho corasick) //! MBox parsing is also not particularly fast as it currently doesn't use parallelism -use eyre::eyre; use mbox_reader; +use ps_core::eyre::eyre; +use ps_core::tracing; use rayon::prelude::*; -use tracing; use walkdir::WalkDir; use super::{Config, ImporterFormat, Message, MessageSender, Result}; diff --git a/ps-importer/src/formats/mod.rs b/ps-importer/src/formats/mod.rs index 6164dfb..ed63f3a 100644 --- a/ps-importer/src/formats/mod.rs +++ b/ps-importer/src/formats/mod.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -pub use eyre::Result; +pub use ps_core::eyre::Result; mod apple_mail; mod gmailbackup; diff --git a/ps-importer/src/formats/shared/database.rs b/ps-importer/src/formats/shared/database.rs index 5cbef7a..04eba92 100644 --- a/ps-importer/src/formats/shared/database.rs +++ b/ps-importer/src/formats/shared/database.rs @@ -1,7 +1,8 @@ use super::parse::{parse_email, ParseableEmail}; use ps_core::{Config, DBMessage, DatabaseLike, Message, MessageSender}; -use eyre::{bail, Result}; +use ps_core::eyre::{self, bail, Result}; +use ps_core::tracing; use rayon::prelude::*; pub fn into_database( diff --git a/ps-importer/src/formats/shared/filesystem.rs b/ps-importer/src/formats/shared/filesystem.rs index eff6f41..ab3b8d7 100644 --- a/ps-importer/src/formats/shared/filesystem.rs +++ b/ps-importer/src/formats/shared/filesystem.rs @@ -1,6 +1,6 @@ -use eyre::{bail, Result}; +use ps_core::eyre::{bail, Result}; +use ps_core::tracing::{self, trace}; use rayon::prelude::*; -use tracing::trace; use std::path::{Path, PathBuf}; diff --git a/ps-importer/src/formats/shared/parse.rs b/ps-importer/src/formats/shared/parse.rs index 465c970..f0736f4 100644 --- a/ps-importer/src/formats/shared/parse.rs +++ b/ps-importer/src/formats/shared/parse.rs @@ -1,6 +1,8 @@ -use chrono::prelude::*; use email_parser::address::{Address, EmailAddress, Mailbox}; -use eyre::{eyre, Result}; +use ps_core::chrono; +use ps_core::chrono::prelude::*; +use ps_core::eyre::{eyre, Result}; +use ps_core::tracing; use std::borrow::Cow; use std::collections::HashSet; diff --git a/ps-importer/src/lib.rs b/ps-importer/src/lib.rs index 6088394..bb985c9 100644 --- a/ps-importer/src/lib.rs +++ b/ps-importer/src/lib.rs @@ -1,4 +1,4 @@ -use eyre::Result; +use ps_core::eyre::Result; pub(crate) mod formats; @@ -47,7 +47,7 @@ impl Importerlike for Importer { Ok(_) => Ok(()), Err(e) => match outer_sender.send(Message::Error(e)) { Ok(_) => Ok(()), - Err(e) => Err(eyre::Report::new(e)), + Err(e) => Err(ps_core::eyre::Report::new(e)), }, } });