mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
uucore: Remove custom_tz_fmt, cleanup dependencies
Nobody needs it anymore.
This commit is contained in:
parent
eb5fc4c4cb
commit
986bdf545d
9 changed files with 6 additions and 200 deletions
32
Cargo.lock
generated
32
Cargo.lock
generated
|
@ -314,27 +314,6 @@ dependencies = [
|
|||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono-tz"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efdce149c370f133a071ca8ef6ea340b7b88748ab0810097a9e2976eaa34b4f3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz-build",
|
||||
"phf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono-tz-build"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e94fea34d77a245229e7746bd2beb786cd2a896f306ff491fb8cecb3074b10a7"
|
||||
dependencies = [
|
||||
"parse-zoneinfo",
|
||||
"phf_codegen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.8.1"
|
||||
|
@ -1798,15 +1777,6 @@ dependencies = [
|
|||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parse-zoneinfo"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24"
|
||||
dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parse_datetime"
|
||||
version = "0.9.0"
|
||||
|
@ -3738,7 +3708,6 @@ dependencies = [
|
|||
"blake2b_simd",
|
||||
"blake3",
|
||||
"chrono",
|
||||
"chrono-tz",
|
||||
"clap",
|
||||
"crc32fast",
|
||||
"data-encoding",
|
||||
|
@ -3750,7 +3719,6 @@ dependencies = [
|
|||
"fluent-bundle",
|
||||
"glob",
|
||||
"hex",
|
||||
"iana-time-zone",
|
||||
"itertools 0.14.0",
|
||||
"libc",
|
||||
"md-5",
|
||||
|
|
|
@ -282,7 +282,6 @@ chrono = { version = "0.4.41", default-features = false, features = [
|
|||
"alloc",
|
||||
"clock",
|
||||
] }
|
||||
chrono-tz = "0.10.0"
|
||||
clap = { version = "4.5", features = ["wrap_help", "cargo"] }
|
||||
clap_complete = "4.4"
|
||||
clap_mangen = "0.2"
|
||||
|
@ -301,7 +300,6 @@ gcd = "2.3"
|
|||
glob = "0.3.1"
|
||||
half = "2.4.1"
|
||||
hostname = "0.4"
|
||||
iana-time-zone = "0.1.57"
|
||||
indicatif = "0.17.8"
|
||||
itertools = "0.14.0"
|
||||
jiff = { version = "0.2.10", default-features = false, features = [
|
||||
|
|
102
fuzz/Cargo.lock
generated
102
fuzz/Cargo.lock
generated
|
@ -219,27 +219,6 @@ dependencies = [
|
|||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono-tz"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efdce149c370f133a071ca8ef6ea340b7b88748ab0810097a9e2976eaa34b4f3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz-build",
|
||||
"phf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono-tz-build"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f10f8c9340e31fc120ff885fcdb54a0b48e474bbd77cab557f0c30a3e569402"
|
||||
dependencies = [
|
||||
"parse-zoneinfo",
|
||||
"phf_codegen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.38"
|
||||
|
@ -872,15 +851,6 @@ dependencies = [
|
|||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parse-zoneinfo"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24"
|
||||
dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parse_datetime"
|
||||
version = "0.9.0"
|
||||
|
@ -892,44 +862,6 @@ dependencies = [
|
|||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
|
||||
dependencies = [
|
||||
"phf_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_codegen"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
|
||||
dependencies = [
|
||||
"phf_generator",
|
||||
"phf_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
|
||||
dependencies = [
|
||||
"phf_shared",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
|
@ -984,15 +916,6 @@ version = "5.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.1"
|
||||
|
@ -1000,7 +923,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core 0.9.3",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1010,15 +933,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.9.3",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.3"
|
||||
|
@ -1189,12 +1106,6 @@ version = "2.7.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
||||
|
||||
[[package]]
|
||||
name = "sm3"
|
||||
version = "0.4.2"
|
||||
|
@ -1442,7 +1353,7 @@ dependencies = [
|
|||
"itertools",
|
||||
"memchr",
|
||||
"nix",
|
||||
"rand 0.9.1",
|
||||
"rand",
|
||||
"rayon",
|
||||
"self_cell",
|
||||
"tempfile",
|
||||
|
@ -1499,8 +1410,6 @@ dependencies = [
|
|||
"bigdecimal",
|
||||
"blake2b_simd",
|
||||
"blake3",
|
||||
"chrono",
|
||||
"chrono-tz",
|
||||
"clap",
|
||||
"crc32fast",
|
||||
"data-encoding",
|
||||
|
@ -1511,7 +1420,6 @@ dependencies = [
|
|||
"fluent-bundle",
|
||||
"glob",
|
||||
"hex",
|
||||
"iana-time-zone",
|
||||
"itertools",
|
||||
"libc",
|
||||
"md-5",
|
||||
|
@ -1538,7 +1446,7 @@ name = "uucore-fuzz"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"libfuzzer-sys",
|
||||
"rand 0.9.1",
|
||||
"rand",
|
||||
"uu_cksum",
|
||||
"uu_cut",
|
||||
"uu_date",
|
||||
|
@ -1571,7 +1479,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"console",
|
||||
"libc",
|
||||
"rand 0.9.1",
|
||||
"rand",
|
||||
"similar",
|
||||
"tempfile",
|
||||
"uucore",
|
||||
|
|
|
@ -26,7 +26,7 @@ jiff = { workspace = true, features = [
|
|||
"tzdb-zoneinfo",
|
||||
"tzdb-concatenated",
|
||||
] }
|
||||
uucore = { workspace = true, features = ["custom-tz-fmt", "parser"] }
|
||||
uucore = { workspace = true, features = ["parser"] }
|
||||
parse_datetime = { workspace = true }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
|
|
@ -37,7 +37,6 @@ terminal_size = { workspace = true }
|
|||
thiserror = { workspace = true }
|
||||
uucore = { workspace = true, features = [
|
||||
"colors",
|
||||
"custom-tz-fmt",
|
||||
"entries",
|
||||
"format",
|
||||
"fs",
|
||||
|
|
|
@ -21,7 +21,6 @@ path = "src/lib/lib.rs"
|
|||
|
||||
[dependencies]
|
||||
chrono = { workspace = true, optional = true }
|
||||
chrono-tz = { workspace = true, optional = true }
|
||||
clap = { workspace = true }
|
||||
uucore_procs = { workspace = true }
|
||||
number_prefix = { workspace = true }
|
||||
|
@ -29,7 +28,6 @@ dns-lookup = { workspace = true, optional = true }
|
|||
dunce = { version = "1.0.4", optional = true }
|
||||
wild = "2.2.1"
|
||||
glob = { workspace = true, optional = true }
|
||||
iana-time-zone = { workspace = true, optional = true }
|
||||
itertools = { workspace = true, optional = true }
|
||||
time = { workspace = true, optional = true, features = [
|
||||
"formatting",
|
||||
|
@ -138,6 +136,5 @@ utf8 = []
|
|||
utmpx = ["time", "time/macros", "libc", "dns-lookup"]
|
||||
version-cmp = []
|
||||
wide = []
|
||||
custom-tz-fmt = ["chrono", "chrono-tz", "iana-time-zone"]
|
||||
tty = []
|
||||
uptime = ["chrono", "libc", "windows-sys", "utmpx", "utmp-classic"]
|
||||
|
|
|
@ -14,8 +14,6 @@ pub mod buf_copy;
|
|||
pub mod checksum;
|
||||
#[cfg(feature = "colors")]
|
||||
pub mod colors;
|
||||
#[cfg(feature = "custom-tz-fmt")]
|
||||
pub mod custom_tz_fmt;
|
||||
#[cfg(feature = "encoding")]
|
||||
pub mod encoding;
|
||||
#[cfg(feature = "extendedbigdecimal")]
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
// This file is part of the uutils coreutils package.
|
||||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use chrono::{TimeZone, Utc};
|
||||
use chrono_tz::{OffsetName, Tz};
|
||||
use iana_time_zone::get_timezone;
|
||||
|
||||
/// Get the alphabetic abbreviation of the current timezone.
|
||||
///
|
||||
/// For example, "UTC" or "CET" or "PDT"
|
||||
fn timezone_abbreviation() -> String {
|
||||
let tz = match std::env::var("TZ") {
|
||||
// TODO Support other time zones...
|
||||
Ok(s) if s == "UTC0" || s.is_empty() => Tz::Etc__UTC,
|
||||
_ => match get_timezone() {
|
||||
Ok(tz_str) => tz_str.parse().unwrap(),
|
||||
Err(_) => Tz::Etc__UTC,
|
||||
},
|
||||
};
|
||||
|
||||
let offset = tz.offset_from_utc_date(&Utc::now().date_naive());
|
||||
offset.abbreviation().unwrap_or("UTC").to_string()
|
||||
}
|
||||
|
||||
/// Adapt the given string to be accepted by the chrono library crate.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// fmt: the format of the string
|
||||
///
|
||||
/// # Return
|
||||
///
|
||||
/// A string that can be used as parameter of the chrono functions that use formats
|
||||
pub fn custom_time_format(fmt: &str) -> String {
|
||||
// TODO - Revisit when chrono 0.5 is released. https://github.com/chronotope/chrono/issues/970
|
||||
// chrono crashes on %#z, but it's the same as %z anyway.
|
||||
// GNU `date` uses `%N` for nano seconds, however the `chrono` crate uses `%f`.
|
||||
fmt.replace("%#z", "%z")
|
||||
.replace("%N", "%f")
|
||||
.replace("%Z", timezone_abbreviation().as_ref())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{custom_time_format, timezone_abbreviation};
|
||||
|
||||
#[test]
|
||||
fn test_custom_time_format() {
|
||||
assert_eq!(custom_time_format("%Y-%m-%d %H-%M-%S"), "%Y-%m-%d %H-%M-%S");
|
||||
assert_eq!(custom_time_format("%d-%m-%Y %H-%M-%S"), "%d-%m-%Y %H-%M-%S");
|
||||
assert_eq!(custom_time_format("%Y-%m-%d %H-%M-%S"), "%Y-%m-%d %H-%M-%S");
|
||||
assert_eq!(
|
||||
custom_time_format("%Y-%m-%d %H-%M-%S.%N"),
|
||||
"%Y-%m-%d %H-%M-%S.%f"
|
||||
);
|
||||
assert_eq!(custom_time_format("%Z"), timezone_abbreviation());
|
||||
}
|
||||
}
|
|
@ -41,8 +41,6 @@ pub use crate::features::buf_copy;
|
|||
pub use crate::features::checksum;
|
||||
#[cfg(feature = "colors")]
|
||||
pub use crate::features::colors;
|
||||
#[cfg(feature = "custom-tz-fmt")]
|
||||
pub use crate::features::custom_tz_fmt;
|
||||
#[cfg(feature = "encoding")]
|
||||
pub use crate::features::encoding;
|
||||
#[cfg(feature = "extendedbigdecimal")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue