From 48c81da1a6c7625b173f247944cfe9eee2cece0a Mon Sep 17 00:00:00 2001 From: j178 <10510431+j178@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:54:42 +0800 Subject: [PATCH] Revert "A confirming test (should revert after test passed)" This reverts commit df5066d677cce04afdb656c5f6407b34948d5571. --- Cargo.lock | 42 +------------------ crates/uv-cache/src/cli.rs | 1 + crates/uv-tool/Cargo.toml | 4 -- crates/uv-tool/src/lib.rs | 82 -------------------------------------- 4 files changed, 2 insertions(+), 127 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f637637236507..e68f2e178d031 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -917,27 +917,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "directories" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "doc-comment" version = "0.3.3" @@ -2179,12 +2158,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "overload" version = "0.1.1" @@ -2680,17 +2653,6 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "reflink-copy" version = "0.1.19" @@ -5202,8 +5164,6 @@ dependencies = [ name = "uv-tool" version = "0.0.1" dependencies = [ - "directories", - "dirs-sys", "etcetera", "fs-err", "pathdiff", @@ -5517,7 +5477,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/crates/uv-cache/src/cli.rs b/crates/uv-cache/src/cli.rs index 1ffabc57ce025..aa38b6c94e1b2 100644 --- a/crates/uv-cache/src/cli.rs +++ b/crates/uv-cache/src/cli.rs @@ -1,3 +1,4 @@ +use std::ffi::c_float; use std::io; use std::path::{Path, PathBuf}; diff --git a/crates/uv-tool/Cargo.toml b/crates/uv-tool/Cargo.toml index e60d7ac140fc5..2c5b4c09b233c 100644 --- a/crates/uv-tool/Cargo.toml +++ b/crates/uv-tool/Cargo.toml @@ -33,7 +33,3 @@ thiserror = { workspace = true } toml = { workspace = true } toml_edit = { workspace = true } tracing = { workspace = true } - -[dev-dependencies] -directories = "5.0.1" -dirs-sys = "0.4.1" diff --git a/crates/uv-tool/src/lib.rs b/crates/uv-tool/src/lib.rs index b554cbf66e416..ee92cffa801ef 100644 --- a/crates/uv-tool/src/lib.rs +++ b/crates/uv-tool/src/lib.rs @@ -458,85 +458,3 @@ pub fn entrypoint_paths( Ok(entrypoints) } - -#[cfg(test)] -mod tests { - use etcetera::BaseStrategy; - use std::path::PathBuf; - - fn dirs_before() -> (PathBuf, PathBuf, PathBuf, PathBuf) { - let data_dir = directories::ProjectDirs::from("", "", "uv") - .unwrap() - .data_dir() - .to_path_buf(); - - let cache_dir = directories::ProjectDirs::from("", "", "uv") - .unwrap() - .cache_dir() - .to_path_buf(); - - let config_dir = { - // On Windows, use, e.g., C:\Users\Alice\AppData\Roaming - #[cfg(windows)] - { - dirs_sys::known_folder_roaming_app_data() - } - // On Linux and macOS, use, e.g., /home/alice/.config. - #[cfg(not(windows))] - { - std::env::var_os("XDG_CONFIG_HOME") - .and_then(dirs_sys::is_absolute_path) - .or_else(|| dirs_sys::home_dir().map(|path| path.join(".config"))) - } - }; - - let home_dir = { - #[cfg(windows)] - { - dirs_sys::known_folder_profile() - } - #[cfg(not(windows))] - { - dirs_sys::home_dir() - } - }; - - (data_dir, cache_dir, config_dir.unwrap(), home_dir.unwrap()) - } - - fn dirs_after() -> (PathBuf, PathBuf, PathBuf, PathBuf) { - let data_dir = etcetera::base_strategy::choose_native_strategy() - .unwrap() - .data_dir() - .join("uv"); - let data_dir = if cfg!(windows) { - data_dir.join("data") - } else { - data_dir - }; - - let cache_dir = etcetera::base_strategy::choose_native_strategy() - .unwrap() - .cache_dir() - .join("uv"); - let cache_dir = if cfg!(windows) { - cache_dir.join("cache") - } else { - cache_dir - }; - - let config_dir = etcetera::base_strategy::choose_base_strategy() - .unwrap() - .config_dir(); - let home_dir = etcetera::home_dir().unwrap(); - - (data_dir, cache_dir, config_dir, home_dir) - } - - #[test] - fn ensure_directory_not_changed() { - let before = dirs_before(); - let after = dirs_after(); - assert_eq!(before, after); - } -}