From c2efbd38c877c7258e90ff55f8fd16a91ffbb400 Mon Sep 17 00:00:00 2001 From: Craig Date: Tue, 21 May 2024 08:56:20 -0700 Subject: [PATCH 1/4] Add plural rules to CPP --- executors/cpp/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/executors/cpp/main.cpp b/executors/cpp/main.cpp index de3ff528..60d81cb8 100644 --- a/executors/cpp/main.cpp +++ b/executors/cpp/main.cpp @@ -45,14 +45,16 @@ extern const string test_langnames(json_object *json_in); extern const string test_likely_subtags(json_object *json_in); extern const string test_list_fmt(json_object *json_in); extern const string test_numfmt(json_object *json_in); +extern const string TestPluralRules(json_object *json_in); -std::string supported_tests[6] = { +std::string supported_tests[7] = { "collation_short", "datetime_fmt", "likely_subtags", "list_fmt", "lang_names", - "number_fmt" + "number_fmt", + "plural_rules" }; @@ -120,6 +122,9 @@ int main(int argc, const char** argv) else if (test_type == "lang_names") { outputLine = test_langnames(json_input); } + else if (test_type == "plural_rules") { + outputLine = TestPluralRules(json_input); + } else { outputLine = "# BAD TEST " + test_type; // "{\"error\": \"unknown test type\"," + From e2b1cf5e14e76e1f401bd12b0029f0b7d99ae594 Mon Sep 17 00:00:00 2001 From: Craig Date: Fri, 21 Jun 2024 16:52:28 -0700 Subject: [PATCH 2/4] Add the Rust datetime fmt code --- executors/rust/1.3/src/relativedatetimefmt.rs | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 executors/rust/1.3/src/relativedatetimefmt.rs diff --git a/executors/rust/1.3/src/relativedatetimefmt.rs b/executors/rust/1.3/src/relativedatetimefmt.rs new file mode 100644 index 00000000..3f1fe0cf --- /dev/null +++ b/executors/rust/1.3/src/relativedatetimefmt.rs @@ -0,0 +1,104 @@ + // https://docs.rs/icu/1.3.2/icu/datetime/struct.DateTimeFormatter.html + +use icu::calendar::DateTime; +use icu::calendar::{buddhist::Buddhist, + chinese::Chinese, + coptic::Coptic, + dangi::Dangi, + ethopian::Ethopian, + gergorian::Gregorian, + hewbrew::Hebrew, + indian::Indian, + iso::ISO, + japanese::Japanese, + julian::Julian, + persian::Persian, + roc::Roc, + Date}; + +use icu::datetime::{options::length, DateTimeFormatter}; +// use icu::datetime::input::DateTimeInput; +use icu_provider::DataLocale; + +use icu::locid::Locale; + +use serde_json::{json, Value}; +use serde::{Deserialize,Serialize}; + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +struct DateTimeFormatOptions { + date_style: Option, + time_style: Option, + time_zone: Option, + era: Option, + calendar: Option, + numbering_system: Option +} + +pub fn run_datetimeformat_test(json_obj: &Value) -> Result { + let label = &json_obj["label"].as_str().unwrap(); + + let langid: Locale = json_obj + .get("locale") + .map(|locale_name| locale_name.as_str().unwrap().parse().unwrap()) + .unwrap_or_default(); + + let data_locale = DataLocale::from(langid); + + // If there are unsupported values, return + // "unsupported" rather than an error. + let options = &json_obj["options"]; // This will be an array. + + let mut _unsupported_options: Vec<&str> = Vec::new(); + + // handle options - maybe done? + + // TODO: handle calendar + // TODO: dateStyle + // TODO: timeStyle + // TODO: timeZone + // TODO: era + // TODO: skeleton + + // Set up DT options + let dt_options = length::Bag::from_date_time_style( + length::Date::Medium, + length::Time::Short + ); + + let option_struct: DateTimeFormatOptions = + serde_json::from_str(&options.to_string()).unwrap(); + + // TODO: !!! time input in ISO format. + // let input_string = &json_obj["input_string"].as_str().unwrap(); + + // let iso_input = DateTime::try_new_iso_datetime(input_string); + + let dtf = DateTimeFormatter::try_new( + &data_locale, + dt_options.into(), + ) + .expect("Failed to create DateTimeFormatter instance."); + + // !!! TEMPORARY ! + let date_iso = DateTime::try_new_iso_datetime(2020, 9, 1, 12, 34, 28) + .expect("Failed to construct DateTime."); + let any_datetime = date_iso.to_any(); + + // !!! Calendar. + let calendar_type = gregorian; + let calendar_date = date_iso.to_calendar(calendar_type); + + // Result to stdout. + // TODO: get the date/time info from a skeleton. + let formatted_dt = dtf.format(&any_datetime).expect("should work"); + let result_string = formatted_dt.to_string(); + + Ok(json!({ + "label": label, + "result": result_string, + "actual_options": format!("{option_struct:?}, {options:?}"), + })) + +} From 8be846e324bab2926d060bcd8a569b3bdf2c8468 Mon Sep 17 00:00:00 2001 From: Craig Cornelius Date: Thu, 11 Jul 2024 08:21:06 -0700 Subject: [PATCH 3/4] Rust datetime fmt and updates to ICU4C and NodeJS (#240) * Add plural rules to CPP * Starting ICU4X datetime fmt * DateTime format: Set default timezone explicitly * Fix formatting * Added ICU4X timezone computation - not working yet! * DateTime generator updated to ISO formatted string * DateTime updates for Node and ICU4C. * Formatted src/datetimefmt.rs * Updated using CustomTimeZone in ICU4X date time fmt * Cargo clippified * Remove unused function * Update version to ~1.3 --- executors/cpp/datetime_fmt.cpp | 32 +- executors/node/datetime_fmt.js | 21 +- executors/node/executor.js | 2 +- executors/rust/1.3/Cargo.lock | 316 +++++++++++------- executors/rust/1.3/Cargo.toml | 4 +- executors/rust/1.3/src/datetimefmt.rs | 192 +++++++++++ executors/rust/1.3/src/main.rs | 4 + executors/rust/1.4/Cargo.lock | 398 ++++++++++++----------- executors/rust/1.4/Cargo.toml | 5 +- run_config.json | 2 + schema/likely_subtags/result_schema.json | 2 +- testgen/generators/datetime_gen.js | 211 ++++++++++-- 12 files changed, 836 insertions(+), 353 deletions(-) create mode 100644 executors/rust/1.3/src/datetimefmt.rs diff --git a/executors/cpp/datetime_fmt.cpp b/executors/cpp/datetime_fmt.cpp index 6179d242..eb133a4e 100644 --- a/executors/cpp/datetime_fmt.cpp +++ b/executors/cpp/datetime_fmt.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include "unicode/utypes.h" @@ -130,6 +131,10 @@ const string TestDatetimeFmt(json_object *json_in) { timezone_str = json_object_get_string(option_item); UnicodeString u_tz(timezone_str.c_str()); tz = TimeZone::createTimeZone(u_tz); + } else { + // Default is UTC + UnicodeString u_tz("UTC"); + tz = TimeZone::createTimeZone(u_tz); } } @@ -180,9 +185,10 @@ const string TestDatetimeFmt(json_object *json_in) { return json_object_to_json_string(return_json); } - if (tz) { - df->setTimeZone(*tz); - } + // !!! IS OFFSET ALREADY CONSIDERED? + // if (tz) { + // df->setTimeZone(*tz); + // } // Use ISO string form of the date/time. @@ -197,9 +203,26 @@ const string TestDatetimeFmt(json_object *json_in) { string input_date_string = json_object_get_string(input_string_obj); + // SimpleDateFormat can't parse options or timezone offset + // First, remove options starting with "[" + std:size_t pos = input_date_string.find("["); + if (pos >= 0) { + input_date_string = input_date_string.substr(0, pos); + } + // Now remove the explicit offset + pos = input_date_string.find("+"); + if (pos >= 0) { + input_date_string = input_date_string.substr(0, pos); + } + pos = input_date_string.rfind("-"); + if (pos >= 10) { + // DOn't clip in the date fields + input_date_string = input_date_string.substr(0, pos); + } UnicodeString date_ustring(input_date_string.c_str()); - SimpleDateFormat iso_date_fmt(u"y-M-d'T'h:m:s.SSSZ", und_locale, status); + // TODO: handles the offset +/- + SimpleDateFormat iso_date_fmt(u"y-M-d'T'h:m:s", und_locale, status); if (U_FAILURE(status)) { string error_name = u_errorName(status); string error_message = @@ -215,6 +238,7 @@ const string TestDatetimeFmt(json_object *json_in) { } // Get date from the parser if possible. + test_date_time = iso_date_fmt.parse(date_ustring, status); if (U_FAILURE(status)) { diff --git a/executors/node/datetime_fmt.js b/executors/node/datetime_fmt.js index 82eac89e..4403055b 100644 --- a/executors/node/datetime_fmt.js +++ b/executors/node/datetime_fmt.js @@ -25,13 +25,31 @@ module.exports = { } let return_json = {'label': label}; + let timezone; + try { + timezone = test_options['time_zone']; + } catch { + timezone = options['timeZone'] = 'UTC'; + } // Get the date from input milliseconds. // Prefer milliseconds + let iso_date; let test_date; // Parse the input string as a date. if (json['input_string']) { - test_date = new Date(json['input_string']); + iso_date = json['input_string']; + // Remove anything starting with "[" + let option_start = iso_date.indexOf('['); + let test_date_string; + if (option_start >= 0) { + // TODO: !! Get the timezone and calendar from the iso_date string. + test_date_string = iso_date.substring(0, option_start); + } else { + test_date_string = iso_date; + } + console.log('test_date_string %s', test_date_string); + test_date = new Date(test_date_string); } try { @@ -59,6 +77,7 @@ module.exports = { try { const formatted_dt = dt_formatter.format(test_date); + return_json['actual_options'] = test_options; return_json['result'] = formatted_dt; } catch (error) { return_json['unsupported'] = ': ' + error.message; diff --git a/executors/node/executor.js b/executors/node/executor.js index ec7de8aa..2bfd7dc4 100644 --- a/executors/node/executor.js +++ b/executors/node/executor.js @@ -255,7 +255,7 @@ rl.on('line', function(line) { const jsonOut = JSON.stringify(outputLine); - if ('error' in outputLine) { + if ('error' in outputLine && !('unsupported' in outputLine)) { // To get the attention of the driver console.log("#!! ERROR in NODE call: test_type: " + test_type + ", " + JSON.stringify(outputLine)); } diff --git a/executors/rust/1.3/Cargo.lock b/executors/rust/1.3/Cargo.lock index 1d91c954..63da2873 100644 --- a/executors/rust/1.3/Cargo.lock +++ b/executors/rust/1.3/Cargo.lock @@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "byteorder" @@ -42,9 +42,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "calendrical_calculations" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dfe3bc6a50b4667fafdb6d9cf26731c5418c457e317d8166c972014facf9a5d" +checksum = "cec493b209a1b81fa32312d7ceca1b547d341c7b5f16a3edbf32b1d8b455bbdf" dependencies = [ "core_maths", "displaydoc", @@ -52,18 +52,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -76,7 +76,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.20", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -99,27 +99,24 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "databake" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82175d72e69414ceafbe2b49686794d3a8bed846e0d50267355f83ea8fdd953a" +checksum = "6a04fbfbecca8f0679c8c06fef907594adcc3e2052e11163a6d30535a1a5604d" dependencies = [ "databake-derive", "proc-macro2", @@ -128,9 +125,9 @@ dependencies = [ [[package]] name = "databake-derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377af281d8f23663862a7c84623bc5dcf7f8c44b13c7496a590bdc157f941a43" +checksum = "4078275de501a61ceb9e759d37bdd3d7210e654dbc167ac1a3678ef4435ed57b" dependencies = [ "proc-macro2", "quote", @@ -140,18 +137,18 @@ dependencies = [ [[package]] name = "deduplicating_array" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a636096586ca093a10ac0175bfb384d024089dca0dae54e3e69bc1c1596358e8" +checksum = "1d579f0dbb23612a78e2d3a483dd1bff5edafa84592d15ba5eb5e3fd689b7d98" dependencies = [ "serde", ] [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", @@ -160,15 +157,15 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elsa" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714f766f3556b44e7e4776ad133fcc3445a489517c25c704ace411bb14790194" +checksum = "d98e71ae4df57d214182a2e5cb90230c0192c6ddfcaa05c36453d46a54713e10" dependencies = [ "stable_deref_trait", ] @@ -205,6 +202,7 @@ dependencies = [ "icu", "icu_datagen", "icu_provider", + "ixdtf", "json", "log", "rustc_version_runtime", @@ -226,9 +224,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -809,9 +807,18 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "ixdtf" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "2123305f927452a9502fc05c33800280d90127c95c50eb45ec6b3c50346afbf3" +dependencies = [ + "displaydoc", +] [[package]] name = "json" @@ -821,9 +828,9 @@ checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -833,18 +840,18 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "litemap" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" dependencies = [ "serde", ] [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "matrixmultiply" @@ -858,15 +865,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -886,52 +893,51 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -944,14 +950,14 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "regex" -version = "1.10.2" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -966,13 +972,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.4", ] [[package]] @@ -983,9 +989,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rustc_version" @@ -1008,9 +1014,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "semver" @@ -1023,9 +1029,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] @@ -1038,18 +1044,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde-aux" -version = "4.2.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3dfe1b7eb6f9dcf011bd6fad169cdeaae75eda0d61b1a99a3f015b41b0cae39" +checksum = "0d2e8bfba469d06512e11e3311d4d051a4a387a5b42d010404fecf3200321c95" dependencies = [ "serde", "serde_json", @@ -1057,9 +1063,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", @@ -1068,9 +1074,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "itoa", "ryu", @@ -1079,9 +1085,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" dependencies = [ "serde", ] @@ -1100,9 +1106,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "2.0.39" +version = "2.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" dependencies = [ "proc-macro2", "quote", @@ -1111,39 +1117,38 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", "syn", - "unicode-xid", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -1152,9 +1157,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c02bf3c538ab32ba913408224323915f4ef9a6d61c0e85d493f355921c0ece" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "databake", "displaydoc", @@ -1187,23 +1192,17 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "utf16_iter" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52df8b7fb78e7910d776fccf2e42ceaf3604d55e8e7eb2dbd183cb1441d8a692" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" [[package]] name = "utf8_iter" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a8922555b9500e3d865caed19330172cd67cbf82203f1a3311d8c305cc9f33" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "winapi" @@ -1223,11 +1222,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -1236,6 +1235,79 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "write16" version = "1.0.0" @@ -1244,15 +1316,15 @@ checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" [[package]] name = "writeable" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad7bb64b8ef9c0aa27b6da38b452b0ee9fd82beaf276a87dd796fb55cbae14e" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "yoke" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e71b2e4f287f467794c671e2b8f8a5f3716b3c829079a1c44740148eff07e4" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" dependencies = [ "serde", "stable_deref_trait", @@ -1262,9 +1334,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6936f0cce458098a201c245a11bef556c6a0181129c7034d10d76d1ec3a2b8" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" dependencies = [ "proc-macro2", "quote", @@ -1274,18 +1346,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655b0814c5c0b19ade497851070c640773304939a6c0fd5f5fb43da0696d05b7" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" dependencies = [ "proc-macro2", "quote", @@ -1295,9 +1367,9 @@ dependencies = [ [[package]] name = "zerotrie" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0594125a0574fb93059c92c588ab209cc036a23d1baeb3410fa9181bea551a0" +checksum = "fb594dd55d87335c5f60177cee24f19457a5ec10a065e0a3014722ad252d0a1f" dependencies = [ "databake", "displaydoc", @@ -1310,9 +1382,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff4439ae91fb5c72b8abc12f3f2dbf51bd27e6eadb9f8a5bc8898dddb0e27ea" +checksum = "5d7fce6acea41ceb5b97f7aee91a5d876d5fbca1f847cb60e13afecd7093cad0" dependencies = [ "databake", "serde", @@ -1323,9 +1395,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4e5997cbf58990550ef1f0e5124a05e47e1ebd33a84af25739be6031a62c20" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" dependencies = [ "proc-macro2", "quote", diff --git a/executors/rust/1.3/Cargo.toml b/executors/rust/1.3/Cargo.toml index 2d77f603..f97e4d87 100644 --- a/executors/rust/1.3/Cargo.toml +++ b/executors/rust/1.3/Cargo.toml @@ -17,9 +17,11 @@ rustc_version_runtime = "0.1.*" icu = { version = "~1.3", features = ["serde", "icu_compactdecimal", "icu_displaynames", "compiled_data", "icu_relativetime"] } -fixed_decimal = "0.5.3" +fixed_decimal = "=0.5.5" writeable = "0.5.2" +ixdtf = "0.2.0" + [build-dependencies] cargo_metadata = "0.18" icu_datagen = { version = "~1.3", default-features = false } diff --git a/executors/rust/1.3/src/datetimefmt.rs b/executors/rust/1.3/src/datetimefmt.rs new file mode 100644 index 00000000..7f216776 --- /dev/null +++ b/executors/rust/1.3/src/datetimefmt.rs @@ -0,0 +1,192 @@ +// https://docs.rs/icu/1.3.2/icu/datetime/struct.DateTimeFormatter.html +// https://docs.rs/icu/1.3.2/icu/datetime/input/trait.TimeZoneInput.html +// https://docs.rs/ixdtf/latest/ixdtf/ + +use icu::calendar::DateTime; +use icu::datetime::{options::length, ZonedDateTimeFormatter}; +use icu::locid::Locale; + +// https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.maybe_calculate_metazone +use icu::timezone::CustomTimeZone; +use icu::timezone::GmtOffset; +use icu::timezone::MetazoneCalculator; + +use icu_provider::DataLocale; + +use icu::timezone::IanaToBcp47Mapper; + +use ixdtf::parsers::IxdtfParser; + +use serde::{Deserialize, Serialize}; +use serde_json::{json, Value}; + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +struct DateTimeFormatOptions { + date_style: Option, + time_style: Option, + time_zone: Option, + era: Option, + calendar: Option, + numbering_system: Option, +} + +pub fn run_datetimeformat_test(json_obj: &Value) -> Result { + let label = &json_obj["label"].as_str().unwrap(); + + // If there are unsupported values, return + // "unsupported" rather than an error. + let options = &json_obj["options"]; // This will be an array. + + let option_struct: DateTimeFormatOptions = serde_json::from_str(&options.to_string()).unwrap(); + + // Get calendar. If present, add to locale string + // as "-u-ca-" + calendar name. + let calendar_str = &option_struct.calendar; + + let locale_json_str: &str = json_obj["locale"].as_str().unwrap(); + let mut locale_str: String = locale_json_str.to_string(); + // ??? Is calendar necessary with the u-ca option in ISO string? + if calendar_str.is_some() { + locale_str = locale_json_str.to_string() + "-u-ca-" + &calendar_str.as_ref().unwrap(); + } + + let lang_id = if let Ok(lc) = locale_str.parse::() { + lc + } else { + return Ok(json!({ + "label": label, + "error_detail": {"option": locale_str}, + "error_type": "locale problem", + })); + }; + let data_locale = DataLocale::from(lang_id); + + let mut _unsupported_options: Vec<&str> = Vec::new(); + + // TODO: Get and use timeZone + + let option_struct: DateTimeFormatOptions = serde_json::from_str(&options.to_string()).unwrap(); + + let date_style_str = &option_struct.date_style; + let date_style = if date_style_str == &Some("full".to_string()) { + length::Date::Full + } else if date_style_str == &Some("long".to_string()) { + length::Date::Long + } else if date_style_str == &Some("short".to_string()) { + length::Date::Short + } else if date_style_str == &Some("medium".to_string()) { + length::Date::Medium + } else { + length::Date::Full + }; + + // TimeStyle long or full requires that you use ZonedDateTimeFormatter. + // long known issue that is documented and has been filed several times. + // Is fixed in 2.0 + let time_style_str = &option_struct.time_style; + let time_style = if time_style_str == &Some("full".to_string()) { + length::Time::Full + } else if time_style_str == &Some("long".to_string()) { + length::Time::Long + } else if time_style_str == &Some("short".to_string()) { + length::Time::Short + } else if time_style_str == &Some("medium".to_string()) { + length::Time::Medium + } else { + // !!! SET TO UNDEFINED + length::Time::Full + }; + + // Set up DT option if either is set + let dt_options = if date_style_str.is_some() && time_style_str.is_some() { + length::Bag::from_date_time_style(date_style, time_style) + } else if date_style_str.is_none() && time_style_str.is_some() { + length::Bag::from_time_style(time_style) + } else if date_style_str.is_some() && time_style_str.is_none() { + length::Bag::from_date_style(date_style) + } else { + length::Bag::default() + }; + + // Get ISO input string including offset and time zone + let input_iso = &json_obj["input_string"].as_str().unwrap(); + // let input_iso: String = input_time_string.to_string() + "[-00:00]"; + + let dt_iso = IxdtfParser::new(input_iso).parse().unwrap(); + let date = dt_iso.date.unwrap(); + let time = dt_iso.time.unwrap(); + let tz_offset = dt_iso.offset.unwrap(); + let _tz_annotation = dt_iso.tz.unwrap(); + + let datetime_iso = DateTime::try_new_iso_datetime( + date.year, + date.month, + date.day, + time.hour, + time.minute, + time.second, + ) + .expect("Failed to initialize ISO DateTime instance."); + let any_datetime = datetime_iso.to_any(); + + // Testing with a default timezone + let timezone_str = &option_struct.time_zone; + + // https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html + let mapper = IanaToBcp47Mapper::new(); + let mapper_borrowed = mapper.as_borrowed(); + + let mapped_tz = mapper_borrowed.get(timezone_str.as_ref().unwrap()); + let mzc = MetazoneCalculator::new(); + let my_metazone_id = mzc.compute_metazone_from_time_zone(mapped_tz.unwrap(), &datetime_iso); + + // Compute the seconds for the + let offset_seconds = GmtOffset::try_from_offset_seconds( + tz_offset.sign as i32 * (tz_offset.hour as i32 * 3600 + tz_offset.minute as i32 * 60), + ) + .ok(); + + let time_zone = if timezone_str.is_some() { + CustomTimeZone { + gmt_offset: offset_seconds, + time_zone_id: mapped_tz, + metazone_id: my_metazone_id, + zone_variant: None, + } + } else { + // Defaults to UTC + CustomTimeZone::utc() + }; + + // The constructor is called with the given options + // The default parameter is time zone formatter options. Not used yet. + let dtf_result = + ZonedDateTimeFormatter::try_new(&data_locale, dt_options.into(), Default::default()); + + let datetime_formatter = match dtf_result { + Ok(dtf) => dtf, + Err(e) => { + return Ok(json!({ + "label": label, + "error_detail": format!("{option_struct:?}"), + "error_type": format!("Failed to create DateTimeFormatter instance: {e:?}"), + })); + } + }; + + // Note: A "classical" skeleton is used in most cases, but this version + // of the executor does not use it. + + let formatted_dt = datetime_formatter + .format(&any_datetime, &time_zone) + .expect("should work"); + let result_string = formatted_dt.to_string(); + + Ok(json!({ + "label": label, + "result": result_string, + "actual_options": + format!("{tz_offset:?}, {dt_options:?}, {time_zone:?}"), // , {dt_iso:?}"), + })) +} diff --git a/executors/rust/1.3/src/main.rs b/executors/rust/1.3/src/main.rs index c595fabd..97b79afc 100644 --- a/executors/rust/1.3/src/main.rs +++ b/executors/rust/1.3/src/main.rs @@ -17,6 +17,7 @@ // https://unicode-org.github.io/icu4x-docs/doc/icu_collator/index.html mod collator; +mod datetimefmt; mod decimalfmt; mod displaynames; mod langnames; @@ -27,6 +28,7 @@ mod pluralrules; mod relativedatetime_fmt; use collator::run_collation_test; +use datetimefmt::run_datetimeformat_test; use langnames::run_language_name_test; use likelysubtags::run_likelysubtags_test; use listfmt::run_list_fmt_test; @@ -114,6 +116,8 @@ fn main() -> io::Result<()> { run_likelysubtags_test(&json_info) } else if test_type == "list_fmt" { run_list_fmt_test(&json_info) + } else if test_type == "datetime_fmt" { + run_datetimeformat_test(&json_info) } else if test_type == "plural_rules" { run_plural_rules_test(&json_info) } else if test_type == "rdt_fmt" { diff --git a/executors/rust/1.4/Cargo.lock b/executors/rust/1.4/Cargo.lock index d1426a11..e9bda9c6 100644 --- a/executors/rust/1.4/Cargo.lock +++ b/executors/rust/1.4/Cargo.lock @@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "byteorder" @@ -42,9 +42,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "calendrical_calculations" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dfe3bc6a50b4667fafdb6d9cf26731c5418c457e317d8166c972014facf9a5d" +checksum = "cec493b209a1b81fa32312d7ceca1b547d341c7b5f16a3edbf32b1d8b455bbdf" dependencies = [ "core_maths", "displaydoc", @@ -52,18 +52,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -76,7 +76,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.20", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -99,27 +99,24 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "databake" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82175d72e69414ceafbe2b49686794d3a8bed846e0d50267355f83ea8fdd953a" +checksum = "6a04fbfbecca8f0679c8c06fef907594adcc3e2052e11163a6d30535a1a5604d" dependencies = [ "databake-derive", "proc-macro2", @@ -128,9 +125,9 @@ dependencies = [ [[package]] name = "databake-derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377af281d8f23663862a7c84623bc5dcf7f8c44b13c7496a590bdc157f941a43" +checksum = "4078275de501a61ceb9e759d37bdd3d7210e654dbc167ac1a3678ef4435ed57b" dependencies = [ "proc-macro2", "quote", @@ -140,18 +137,18 @@ dependencies = [ [[package]] name = "deduplicating_array" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a636096586ca093a10ac0175bfb384d024089dca0dae54e3e69bc1c1596358e8" +checksum = "1d579f0dbb23612a78e2d3a483dd1bff5edafa84592d15ba5eb5e3fd689b7d98" dependencies = [ "serde", ] [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", @@ -160,15 +157,15 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elsa" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714f766f3556b44e7e4776ad133fcc3445a489517c25c704ace411bb14790194" +checksum = "d98e71ae4df57d214182a2e5cb90230c0192c6ddfcaa05c36453d46a54713e10" dependencies = [ "stable_deref_trait", ] @@ -205,11 +202,13 @@ dependencies = [ "icu", "icu_datagen", "icu_provider", + "ixdtf", "json", "log", "rustc_version_runtime", "serde", "serde_json", + "tinystr", "writeable", ] @@ -226,23 +225,14 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", ] -[[package]] -name = "fraction" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a78dd758a47a7305478e0e054f9fde4e983b9f9eccda162bf7ca03b79e9d40" -dependencies = [ - "num", -] - [[package]] name = "hermit-abi" version = "0.1.19" @@ -312,9 +302,9 @@ checksum = "22aec7d032735d9acb256eeef72adcac43c3b7572f19b51576a63d664b524ca2" [[package]] name = "icu_casemap" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7988d4f2655012592ac5b027722a93fbe12ff2a86d3e0f9ae686aedba0984f5e" +checksum = "8cc79a14966c4adc6929cafba6903ce1140909364c40e90262bd70ad1bf41c1f" dependencies = [ "databake", "displaydoc", @@ -411,14 +401,13 @@ checksum = "53eaf4902ee2e804f2583611722f6961fe85f31eab7ec790f47dde2d1cd494fb" [[package]] name = "icu_datagen" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e2d9466b2860a0c23132001e774589624c264e48b98d14382d71805404d56a" +checksum = "5a21dec81a41daa5848ed26b230c90656616d4e35557a88a683e311773faa01d" dependencies = [ "displaydoc", "either", "elsa", - "fraction", "icu_calendar", "icu_casemap", "icu_codepointtrie_builder", @@ -440,7 +429,6 @@ dependencies = [ "log", "memchr", "ndarray", - "num-bigint", "once_cell", "serde", "serde-aux", @@ -592,9 +580,9 @@ checksum = "545c6c3e8bf9580e2dafee8de6f9ec14826aaf359787789c7724f1f85f47d3dc" [[package]] name = "icu_normalizer" -version = "1.4.0" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "419a6ef743237a64c37619def388b13f6266318a24652dff91ca046a7c4afc40" +checksum = "accb85c5b2e76f8dade22978b3795ae1e550198c6cfc7e915144e17cd6e2ab56" dependencies = [ "databake", "displaydoc", @@ -612,9 +600,9 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22026918a80e6a9a330cb01b60f950e2b4e5284c59528fd0c6150076ef4c8522" +checksum = "e3744fecc0df9ce19999cdaf1f9f3a48c253431ce1d67ef499128fe9d0b607ab" [[package]] name = "icu_plurals" @@ -641,9 +629,9 @@ checksum = "c3acd5f1f2f988ed2dae9316c3d3560dfe4e03a7516d142b4b89b92252ada41a" [[package]] name = "icu_properties" -version = "1.4.0" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976e296217453af983efa25f287a4c1da04b9a63bf1ed63719455068e4453eb5" +checksum = "db9e559598096627aeca8cdfb98138a70eb4078025f8d1d5f2416a361241f756" dependencies = [ "databake", "displaydoc", @@ -658,9 +646,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6a86c0e384532b06b6c104814f9c1b13bcd5b64409001c0d05713a1f3529d99" +checksum = "e70a8b51ee5dd4ff8f20ee9b1dd1bc07afc110886a3747b1fec04cc6e5a15815" [[package]] name = "icu_provider" @@ -822,9 +810,18 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "ixdtf" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "2123305f927452a9502fc05c33800280d90127c95c50eb45ec6b3c50346afbf3" +dependencies = [ + "displaydoc", +] [[package]] name = "json" @@ -834,9 +831,9 @@ checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -846,18 +843,18 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "litemap" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" dependencies = [ "serde", ] [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "matrixmultiply" @@ -871,15 +868,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -897,100 +894,53 @@ dependencies = [ "rawpointer", ] -[[package]] -name = "num" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" -dependencies = [ - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] [[package]] name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", - "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1003,14 +953,14 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "regex" -version = "1.10.2" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -1025,13 +975,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.4", ] [[package]] @@ -1042,9 +992,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rustc_version" @@ -1067,9 +1017,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "semver" @@ -1082,9 +1032,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] @@ -1097,18 +1047,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde-aux" -version = "4.2.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3dfe1b7eb6f9dcf011bd6fad169cdeaae75eda0d61b1a99a3f015b41b0cae39" +checksum = "0d2e8bfba469d06512e11e3311d4d051a4a387a5b42d010404fecf3200321c95" dependencies = [ "serde", "serde_json", @@ -1116,9 +1066,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", @@ -1127,9 +1077,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "itoa", "ryu", @@ -1138,9 +1088,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" dependencies = [ "serde", ] @@ -1159,9 +1109,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "2.0.39" +version = "2.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" dependencies = [ "proc-macro2", "quote", @@ -1170,39 +1120,38 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", "syn", - "unicode-xid", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -1211,9 +1160,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c02bf3c538ab32ba913408224323915f4ef9a6d61c0e85d493f355921c0ece" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "databake", "displaydoc", @@ -1246,23 +1195,17 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "utf16_iter" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52df8b7fb78e7910d776fccf2e42ceaf3604d55e8e7eb2dbd183cb1441d8a692" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" [[package]] name = "utf8_iter" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a8922555b9500e3d865caed19330172cd67cbf82203f1a3311d8c305cc9f33" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "winapi" @@ -1282,11 +1225,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -1295,6 +1238,79 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "write16" version = "1.0.0" @@ -1303,15 +1319,15 @@ checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" [[package]] name = "writeable" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad7bb64b8ef9c0aa27b6da38b452b0ee9fd82beaf276a87dd796fb55cbae14e" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "yoke" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e71b2e4f287f467794c671e2b8f8a5f3716b3c829079a1c44740148eff07e4" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" dependencies = [ "serde", "stable_deref_trait", @@ -1321,9 +1337,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6936f0cce458098a201c245a11bef556c6a0181129c7034d10d76d1ec3a2b8" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" dependencies = [ "proc-macro2", "quote", @@ -1333,18 +1349,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655b0814c5c0b19ade497851070c640773304939a6c0fd5f5fb43da0696d05b7" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" dependencies = [ "proc-macro2", "quote", @@ -1354,9 +1370,9 @@ dependencies = [ [[package]] name = "zerotrie" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0594125a0574fb93059c92c588ab209cc036a23d1baeb3410fa9181bea551a0" +checksum = "fb594dd55d87335c5f60177cee24f19457a5ec10a065e0a3014722ad252d0a1f" dependencies = [ "databake", "displaydoc", @@ -1369,9 +1385,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.10.1" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff4439ae91fb5c72b8abc12f3f2dbf51bd27e6eadb9f8a5bc8898dddb0e27ea" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ "databake", "serde", @@ -1382,9 +1398,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4e5997cbf58990550ef1f0e5124a05e47e1ebd33a84af25739be6031a62c20" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", diff --git a/executors/rust/1.4/Cargo.toml b/executors/rust/1.4/Cargo.toml index 3833b0a5..f242f105 100644 --- a/executors/rust/1.4/Cargo.toml +++ b/executors/rust/1.4/Cargo.toml @@ -17,9 +17,12 @@ rustc_version_runtime = "0.1.*" icu = { version = "~1.4", features = ["serde", "icu_compactdecimal", "icu_displaynames", "icu_relativetime"] } -fixed_decimal = "0.5.3" +fixed_decimal = "=0.5.5" writeable = "0.5.2" +ixdtf = "0.2.0" +tinystr = "0.7.6" + [build-dependencies] cargo_metadata = "0.18" icu_datagen = { version = "~1.4", default-features = false } diff --git a/run_config.json b/run_config.json index a836da1e..5f5b3251 100644 --- a/run_config.json +++ b/run_config.json @@ -273,6 +273,7 @@ "exec": "rust", "test_type": [ "collation_short", + "datetime_fmt", "number_fmt", "lang_names", "likely_subtags", @@ -294,6 +295,7 @@ "exec": "rust", "test_type": [ "collation_short", + "datetime_fmt", "lang_names", "list_fmt", "likely_subtags", diff --git a/schema/likely_subtags/result_schema.json b/schema/likely_subtags/result_schema.json index 5caf279b..2c322b60 100644 --- a/schema/likely_subtags/result_schema.json +++ b/schema/likely_subtags/result_schema.json @@ -3,7 +3,7 @@ "title": "ICU Likely subtags verify data description", "description": "This documents format of likely subtags verify data", "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "test_type": { "description": "The name of the test", diff --git a/testgen/generators/datetime_gen.js b/testgen/generators/datetime_gen.js index 76d8b131..ca3ef472 100644 --- a/testgen/generators/datetime_gen.js +++ b/testgen/generators/datetime_gen.js @@ -93,13 +93,14 @@ const spec_options = [ ]; const timezones = [ - '', + '', // Default to UTC 'America/Los_Angeles', 'Africa/Luanda', 'Asia/Tehran', 'Europe/Kiev', 'Australia/Brisbane', - 'Pacific/Guam', + 'Pacific/Palau', + "America/Montevideo" ]; const pre_gregorian_dates = [ @@ -112,14 +113,102 @@ const pre_gregorian_dates = [ const dates = [ new Date('Mar 17, 2024'), - new Date('AD 1'), - new Date('AD 0, 13:00'), - new Date('1754, May 29, 16:47'), + new Date('02-Jul-2001, 13:14:15'), + new Date('May 29, 1984, 7:53'), + new Date('2050, May 29, 16:47'), new Date('1969, July 16'), new Date(1e9), new Date(1e12), ]; +let temporal_dates = [ + { + timeZone: 'America/Los_Angeles', + year: 2024, + month: 3, + day: 7, + hour: 0, + minute: 0, + second: 1, + millisecond: 0, + microsecond: 0, + nanosecond: 0, + calendar: "gregory" + }, + { + timeZone: 'America/Los_Angeles', + year: 2001, + month: 7, + day: 2, + hour: 13, + minute: 14, + second: 15, + millisecond: 0, + microsecond: 0, + nanosecond: 0 + }, + { + timeZone: 'America/Los_Angeles', + year: 1984, + month: 5, + day: 29, + hour: 7, + minute: 53, + second: 0, + millisecond: 0, + microsecond: 0, + nanosecond: 0 + }, + { + timeZone: 'America/Los_Angeles', + year: 2030, + month: 5, + day: 29, + hour: 16, + minute: 47, + second: 0, + millisecond: 0, + microsecond: 0, + nanosecond: 0 + }, + { + timeZone: 'America/Los_Angeles', + year: 1969, + month: 7, + day: 16, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + microsecond: 0, + nanosecond: 0 + }, + { // 1e9 + timeZone: 'America/Los_Angeles', + year: 1970, + month: 1, + day: 12, + hour: 13, + minute: 46, + second: 40, + millisecond: 0, + microsecond: 0, + nanosecond: 0 + }, + { // 1e12 + timeZone: 'America/Los_Angeles', + year: 2001, + month: 9, + day: 9, + hour: 1, + minute: 46, + second: 40, + millisecond: 0, + microsecond: 0, + nanosecond: 0 + } +]; + const dt_fields = { 'era': { 'long': 'GGGG', @@ -220,10 +309,13 @@ function generateAll(run_limit) { } let verify_cases = []; - let label_num = 0; + let label_num = -1; // Increment before each item - const expected_count = locales.length * calendars.length * spec_options.length * - timezones.length * dates.length; + const expected_count = locales.length * + calendars.length * + spec_options.length * + timezones.length * + dates.length; console.log("Generating ", expected_count, " date/time tests for ", process.versions.icu); console.log(' RUN LIMIT = ', run_limit); @@ -239,15 +331,13 @@ function generateAll(run_limit) { const supported_calendars = intl_locale.calendars; // Check if the calendar system is supported in this locale. // If not, skip the test. - if ( !supported_calendars.includes(calendar)) { - if (debug) { - console.warn(locale + ' does not support ' + calendar); - console.log(locale + ': ' + supported_calendars); - } + if (!supported_calendars || !supported_calendars.includes(calendar)) { + console. continue; } } catch(error) { - console.log('Error: ' + error); + console.log('Supported calendars for %sError: %s', + intl_locale, error); } } for (const option of spec_options) { @@ -258,9 +348,9 @@ function generateAll(run_limit) { } // Rotate timezones through the data, but not as as separate loop - const tz_index = label_num % timezones.length; - timezone = timezones[tz_index]; - //for (const timezone of timezones) { + const tz_index = (label_num + 1) % timezones.length; + let timezone = timezones[tz_index]; + // Set number systems as appropriate for particular locals let number_system = 'latn'; @@ -283,9 +373,14 @@ function generateAll(run_limit) { all_options['calendar'] = calendar; } - if (timezone != '') { + if (timezone) { all_options['timeZone'] = timezone; + } else { + // Default to GMT+00:00 + all_options['timeZone'] = 'UTC' + timezone = 'UTC'; } + if (number_system) { // getNumberingSystems() may not be available yet. // If we have this info and the number system isn't in this local, skip the test. @@ -324,16 +419,68 @@ function generateAll(run_limit) { continue; } - for (const d of dates) { + // Generate this for several actual dates. + for (const date_index in dates) { + label_num ++; + + let this_date = dates[date_index]; + + // Get the temporal representation, including TZ and calendar + let temporal_date = temporal_dates[date_index]; + temporal_date['timeZone'] = timezone; + + try { + let vanilla_locale = 'en-US'; + let vanilla_calendar = 'gregory'; + // temporal_date['calendar'] = vanilla_calendar; + + // For computing the string with Date + let zdt_vanilla = Temporal.ZonedDateTime.from(temporal_date); + try { + this_date = new Date(zdt_vanilla.epochMilliseconds); + } catch (error) { + console.log('new Date fail %s with %s on %s', error, + temporal_date); + continue; + } + if (! this_date) { + console.log('$$$$ %s no date from zdt_to_date. %s, %s %s %s', + label_num, zdt_vanilla, temporal_date, + vanilla_locale, vanilla_calendar); + continue; + } + } catch (error) { + console.log(' SKIPPING %s temporal.from %s: input: %s', + label_num, error, temporal_date); + continue; + } + + // Get the ISO string with + // temporal_date['calendar'] = calendar; + let zdt_full = Temporal.ZonedDateTime.from(temporal_date); + input_string = zdt_full.toString(); + + // !! TEMPORARY !! + // console.log(' TEMPORAL %s %s %s', label_num, input_string, this_date); + let result; + let parts; try { // To avoid the hack that replaces NBSP with ASCII space. - const parts = formatter.formatToParts(d); + try { + parts = formatter.formatToParts(this_date); + } catch (error) { + console.log('!!!!!! %s %s', label_num, error); + console.log(' temporal_data = %s', temporal_date) + console.log(' %s formatToParts with %s', error, this_date); + continue; + } // Handle options that have only era or timeZoneName, working around // https://github.com/tc39/ecma402/issues/461 const keys = Object.keys(option); - if (keys.length == 1 && (keys[0] == 'era' || keys[0] == 'timeZoneName')) { + if (keys.length == 1 && + (keys[0] == 'era' || keys[0] == 'timeZoneName')) { if (calendar == 'chinese') { continue; } @@ -348,17 +495,18 @@ function generateAll(run_limit) { // console.error(' result: ', JSON.stringify(result)); } if (!result || debug) { - console.log(' key = ' + keys[0] + - ', ' + JSON.stringify(all_options)); + console.log('OK! key = %s, %s', + keys[0], + JSON.stringify(all_options)); console.log(' ITEM = ', JSON.stringify(item)) console.log(' PARTS = ', JSON.stringify(parts)); } } catch (error) { - console.error('Error: ' + error + ', key = ' + keys[0] + - ', date = ' + d); - console.error(' ' + JSON.stringify(parts)); - console.error(' ' + JSON.stringify(all_options)); + console.error('PARTS FILTER error: %s, key = ', + error, keys[0], this_date); + console.error(' %s' + JSON.stringify(parts)); + console.error(' %s' + JSON.stringify(all_options)); } } else { @@ -368,7 +516,7 @@ function generateAll(run_limit) { console.warn('no result for ', label_num, ': ', JSON.stringify(all_options)); } } - // console.warn(' result = ', result); + } catch (error) { console.error('FORMATTER result fails! ', error); const keys = Object.keys(all_options); @@ -377,12 +525,12 @@ function generateAll(run_limit) { } // format this date // get the milliseconds - const millis = d.getTime(); + const millis = this_date.getTime(); const label_string = String(label_num); let test_case = {'label': label_string, - 'input_string': d.toISOString(), + 'input_string': input_string }; if (skeleton) { @@ -420,8 +568,9 @@ function generateAll(run_limit) { console.error('!!! error ', error, ' in label ', label_num, ' for date = ', d); } - label_num ++; } + // !!! + // console.log(''); } } } From b119fd2492c225227bd149b8f867d00b895dd24e Mon Sep 17 00:00:00 2001 From: Craig Date: Wed, 17 Jul 2024 16:30:44 -0700 Subject: [PATCH 4/4] Coordinate file write and closures with os.fscync() --- schema/check_generated_data.py | 1 + schema/check_schemas.py | 1 + schema/check_test_output.py | 1 + testdriver/testplan.py | 2 ++ testgen/generators/base.py | 1 + testgen/generators/lang_names.py | 2 ++ testgen/generators/number_fmt.py | 1 + verifier/report_template.py | 13 +++++++++---- verifier/testreport.py | 8 ++++++++ 9 files changed, 26 insertions(+), 4 deletions(-) diff --git a/schema/check_generated_data.py b/schema/check_generated_data.py index f2a20e27..52f2e757 100644 --- a/schema/check_generated_data.py +++ b/schema/check_generated_data.py @@ -91,6 +91,7 @@ def main(args): output_filename = os.path.join(test_data_path, 'test_data_validation_summary.json') file_out = open(output_filename, mode='w', encoding='utf-8') file_out.write(summary_data) + os.fsync(file_out) file_out.close() except BaseException as error: logging.warning('Error: %s. Cannot save validation summary in file %s', err, output_filename) diff --git a/schema/check_schemas.py b/schema/check_schemas.py index 2f2cbb02..0121e9a1 100644 --- a/schema/check_schemas.py +++ b/schema/check_schemas.py @@ -52,6 +52,7 @@ def save_schema_validation_summary(self, validation_status): output_filename = os.path.join(self.schema_base, 'schema_validation_summary.json') file_out = open(output_filename, mode='w', encoding='utf-8') file_out.write(summary_data) + os.fsync(file_out) file_out.close() except BaseException as error: logging.warning('Error: %s. Cannot save validation summary in file %s', err, output_filename) diff --git a/schema/check_test_output.py b/schema/check_test_output.py index fb5fadf6..f09a04fd 100644 --- a/schema/check_test_output.py +++ b/schema/check_test_output.py @@ -115,6 +115,7 @@ def main(args): output_filename = os.path.join(test_output_path, 'test_output_validation_summary.json') file_out = open(output_filename, mode='w', encoding='utf-8') file_out.write(summary_data) + os.fsync(file_out) file_out.close() except BaseException as error: logging.warning('Error: %s. Cannot save validation summary in file %s', error, output_filename) diff --git a/testdriver/testplan.py b/testdriver/testplan.py index 310527ec..1c00a7bc 100644 --- a/testdriver/testplan.py +++ b/testdriver/testplan.py @@ -234,6 +234,7 @@ def complete_output_file(self, error_info): self.resultsFile.write(json.dumps(self.jsonOutput)) self.resultsFile.flush() + os.fsync(self.resultsFile) self.resultsFile.close() def run_one_test_mode(self): @@ -480,6 +481,7 @@ def open_json_test_data(self): input_file = open(self.inputFilePath, encoding='utf-8', mode='r') file_raw = input_file.read() + os.fsync(input_file) input_file.close() try: self.jsonData = json.loads(file_raw) diff --git a/testgen/generators/base.py b/testgen/generators/base.py index 99d8a853..5b2ae8b4 100644 --- a/testgen/generators/base.py +++ b/testgen/generators/base.py @@ -85,6 +85,7 @@ def saveJsonFile(self, filename, data, indent=None): output_path = os.path.join(self.icu_version, filename) output_file = open(output_path, "w", encoding="UTF-8") json.dump(data, output_file, indent=indent) + os.fsync(output_file) output_file.close() def getTestDataFromGitHub(self, datafile_name, version): diff --git a/testgen/generators/lang_names.py b/testgen/generators/lang_names.py index ce23b44b..06e3d5a2 100644 --- a/testgen/generators/lang_names.py +++ b/testgen/generators/lang_names.py @@ -27,11 +27,13 @@ def process_test_data(self): output_path = os.path.join(self.icu_version, "lang_name_test_file.json") lang_name_test_file = open(output_path, "w", encoding="UTF-8") json.dump(self.json_test, lang_name_test_file, indent=1) + os.fsync(lang_name_test_file) lang_name_test_file.close() output_path = os.path.join(self.icu_version, "lang_name_verify_file.json") lang_name_verify_file = open(output_path, "w", encoding="UTF-8") json.dump(self.json_verify, lang_name_verify_file, indent=1) + os.fsync(lang_name_verify_file) lang_name_verify_file.close() return True diff --git a/testgen/generators/number_fmt.py b/testgen/generators/number_fmt.py index f2d799fc..93bfd2b7 100644 --- a/testgen/generators/number_fmt.py +++ b/testgen/generators/number_fmt.py @@ -51,6 +51,7 @@ def process_test_data(self): # TODO: Change these saves to use saveJsonFile with output_path ?? num_fmt_verify_file = open(output_path, "w", encoding="UTF-8") json.dump(json_verify, num_fmt_verify_file, indent=1) + os.fsync(num_fmt_verify_file) num_fmt_verify_file.close() logging.info( diff --git a/verifier/report_template.py b/verifier/report_template.py index cc48b62a..a1e4a002 100644 --- a/verifier/report_template.py +++ b/verifier/report_template.py @@ -4,6 +4,7 @@ import logging import logging.config from string import Template +import os import sys class reportTemplate(): @@ -16,9 +17,11 @@ def __init__(self): try: template_file = open(filename, mode='r') detail_template = template_file.read() + os.fsync(template_file) template_file.close() - except: - logging.error('Cannot open detail template %s', filename) + except BaseException as error: + logging.error('report_template %s : Cannot open detail template %s', + error,filename) self.html_template = Template(detail_template) @@ -27,9 +30,11 @@ def __init__(self): try: template_file = open(filename, mode='r') summary_template = template_file.read() + os.fsync(template_file) template_file.close() - except: - logging.error('Cannot open summary template %s', filename) + except BaseException as error: + logging.error('report_template: %s, Cannot open summary template %s', + error, filename) self.summary_html_template = Template(summary_template) diff --git a/verifier/testreport.py b/verifier/testreport.py index 3be8f973..6ec47bdb 100644 --- a/verifier/testreport.py +++ b/verifier/testreport.py @@ -247,6 +247,7 @@ def save_report(self): report_json = self.create_report() file.write(report_json) + os.fsync(file) file.close() # TODO: Create subdirectory for json results of each type @@ -272,6 +273,7 @@ def create_json_report_tree(self): try: file = open(output_name, mode='w', encoding='utf-8') file.write(json.dumps(case_list)) + os.fsync(file) file.close() except BaseException as err: sys.stderr.write('!!! Cannot write report at %s\n Error = %s' % ( @@ -469,6 +471,7 @@ def create_html_report(self): return None file.write(html_output) + os.fsync(file) file.close() # TODO: write fail_characterized to output file @@ -476,6 +479,7 @@ def create_html_report(self): try: file = open(failure_json_path, mode='w', encoding='utf-8') file.write(json.dumps(flat_combined_dict)) + os.fsync(file) file.close() except Exception as err: logging.warning('!! %s: Cannot write %s fail_characterized data', failure_json_path, err) @@ -775,6 +779,7 @@ def save_characterized_file(self, characterized_data, characterized_type): character_file_path = os.path.join(self.report_directory, file_name) file = open(character_file_path, mode='w', encoding='utf-8') file.write(json_data) + os.fsync(file) file.close() except BaseException as error: logging.error("%s: CANNOT WRITE CHARACTERIZE FILE FOR %s at ", @@ -803,6 +808,7 @@ def create_html_diff_report(self): return None file.write(html_diff_result) + os.fsync(file) file.close() return html_diff_result @@ -1137,6 +1143,7 @@ def create_summary_html(self): logging.debug('HTML OUTPUT =\n%s', html_output) logging.debug('HTML OUTPUT FILEPATH =%s', self.summary_html_path) file.write(html_output) + os.fsync(file) file.close() # Save the exec_summary.json @@ -1147,6 +1154,7 @@ def create_summary_html(self): exec_json_file = open(exec_summary_json_path, mode='w', encoding='utf-8') summary_by_test_type = json.dumps(self.summary_by_test_type) exec_json_file.write(summary_by_test_type) + os.fsync(exec_json_file) exec_json_file.close() except BaseException as err: sys.stderr.write('!!! %s: Cannot write exec_summary.json' % err)