diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44a234daa6e2..50ec986aef12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -291,7 +291,7 @@ jobs: - name: "Cargo test" working-directory: ${{ env.UV_WORKSPACE }} run: | - cargo nextest run --no-default-features --features python,pypi --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 20 --final-status-level slow + cargo nextest run --no-default-features --features python,pypi --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 20 --final-status-level slow tool_install_additional_entrypoints - name: "Smoke test" working-directory: ${{ env.UV_WORKSPACE }} diff --git a/crates/uv-normalize/src/lib.rs b/crates/uv-normalize/src/lib.rs index 0360a5a1a161..a28392883023 100644 --- a/crates/uv-normalize/src/lib.rs +++ b/crates/uv-normalize/src/lib.rs @@ -195,4 +195,13 @@ mod tests { assert!(is_normalized(input).is_err()); } } + + #[test] + fn sorting() { + let first = validate_and_normalize_ref("ansible").unwrap(); + let second = validate_and_normalize_ref("ansible-core").unwrap(); + assert_eq!(first, "ansible"); + assert_eq!(second, "ansible-core"); + assert!(first < second); + } } diff --git a/crates/uv/src/commands/tool/common.rs b/crates/uv/src/commands/tool/common.rs index 5077dbf30bc2..62578866922d 100644 --- a/crates/uv/src/commands/tool/common.rs +++ b/crates/uv/src/commands/tool/common.rs @@ -5,6 +5,7 @@ use std::{collections::BTreeSet, ffi::OsString}; use anyhow::{bail, Context}; use itertools::Itertools; use owo_colors::OwoColorize; +use predicates::str; use tracing::{debug, warn}; use distribution_types::{InstalledDist, Name}; @@ -62,6 +63,7 @@ pub(crate) fn remove_entrypoints(tool: &Tool) { } /// Installs tool executables for a given package and handles any conflicts. +#[allow(clippy::cmp_owned)] pub(crate) fn install_executables( environment: &PythonEnvironment, tool_name: &PackageName, @@ -92,6 +94,10 @@ pub(crate) fn install_executables( installed_dist.version(), )?; + // XXX + let _temp = entry_points.clone(); + // XXX + // Determine the entry points targets. Use a sorted collection for deterministic output. let target_entry_points = entry_points .into_iter() @@ -106,6 +112,38 @@ pub(crate) fn install_executables( }) .collect::>(); + // XXX + #[cfg(windows)] + { + assert!("ansible".to_string() < "ansible-config".to_string()); + let mut test = BTreeSet::new(); + test.insert("ansible".to_string()); + test.insert("ansible-config".to_string()); + if name == &PackageName::new("ansible-core".to_string()).unwrap() { + dbg!(&target_entry_points); + let sorted: BTreeSet<_> = _temp.clone().into_iter().collect(); + dbg!(&sorted); + let sorted2: BTreeSet<_> = _temp.into_iter().map(|(name, _)| name).collect(); + dbg!(&sorted2); + let mut newset = BTreeSet::new(); + let mut newset2 = BTreeSet::new(); + let mut strbytes = vec![]; + for entry in sorted2.clone() { + if entry == "ansible" || entry == "ansible-config" { + newset2.insert(entry.clone()); + } + newset.insert(entry.clone()); + strbytes.push(entry.into_bytes()); + } + dbg!(&newset); + assert_eq!(newset, sorted2); + dbg!(&newset2); + dbg!(&test); + dbg!(&strbytes); + } + } + // XXX + if target_entry_points.is_empty() { writeln!( printer.stdout(),