commit:     191628c88adbee083e9cb95eb45f6306754121d7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 12 11:40:08 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr 12 11:49:12 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=191628c8

dev-python/uv: Fix test failure with Python 3.12.10

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/uv/files/uv-0.6.13-test-ws.patch | 241 ++++++++++++++++++++++++++++
 dev-python/uv/uv-0.6.13.ebuild              |   5 +
 2 files changed, 246 insertions(+)

diff --git a/dev-python/uv/files/uv-0.6.13-test-ws.patch 
b/dev-python/uv/files/uv-0.6.13-test-ws.patch
new file mode 100644
index 000000000000..bda1b6d0c93a
--- /dev/null
+++ b/dev-python/uv/files/uv-0.6.13-test-ws.patch
@@ -0,0 +1,241 @@
+From 5c69e6e3ed1df9b7a2c85b981129a59bf9aec357 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Sat, 12 Apr 2025 13:20:44 +0200
+Subject: [PATCH] Collapse whitespace in python_list tests
+
+Collapse whitespace into a single space in python_list tests, in order
+to make them agnostic of padding, and therefore pass both with Python
+3.12.9 and Python 3.12.10.
+
+Fixes #12799
+---
+ crates/uv/tests/it/common/mod.rs  |  7 ++++
+ crates/uv/tests/it/python_list.rs | 64 ++++++++++++++++---------------
+ 2 files changed, 41 insertions(+), 30 deletions(-)
+
+diff --git a/crates/uv/tests/it/common/mod.rs 
b/crates/uv/tests/it/common/mod.rs
+index 0c6d491f2..09bbbb2b1 100644
+--- a/crates/uv/tests/it/common/mod.rs
++++ b/crates/uv/tests/it/common/mod.rs
+@@ -319,6 +319,13 @@ impl TestContext {
+         self
+     }
+ 
++    /// Add a filter that collapses duplicate whitespace.
++    #[must_use]
++    pub fn with_collapsed_whitespace(mut self) -> Self {
++        self.filters.push((r"[ \t]+".to_string(), " ".to_string()));
++        self
++    }
++
+     /// Add extra directories and configuration for managed Python 
installations.
+     #[must_use]
+     pub fn with_managed_python_dirs(mut self) -> Self {
+diff --git a/crates/uv/tests/it/python_list.rs 
b/crates/uv/tests/it/python_list.rs
+index 347993934..657667861 100644
+--- a/crates/uv/tests/it/python_list.rs
++++ b/crates/uv/tests/it/python_list.rs
+@@ -7,7 +7,8 @@ use crate::common::{uv_snapshot, TestContext};
+ fn python_list() {
+     let mut context: TestContext = TestContext::new_with_versions(&["3.11", 
"3.12"])
+         .with_filtered_python_symlinks()
+-        .with_filtered_python_keys();
++        .with_filtered_python_keys()
++        .with_collapsed_whitespace();
+ 
+     uv_snapshot!(context.filters(), 
context.python_list().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r"
+     success: true
+@@ -22,8 +23,8 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -33,7 +34,7 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]    [PYTHON-3.12]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
+ 
+     ----- stderr -----
+     ");
+@@ -43,7 +44,7 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -53,8 +54,8 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -64,7 +65,7 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]    [PYTHON-3.12]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
+ 
+     ----- stderr -----
+     ");
+@@ -74,7 +75,7 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]    [PYTHON-3.12]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
+ 
+     ----- stderr -----
+     ");
+@@ -87,7 +88,7 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]    [PYTHON-3.12]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
+ 
+     ----- stderr -----
+     ");
+@@ -108,8 +109,8 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -119,7 +120,7 @@ fn python_list() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -129,7 +130,8 @@ fn python_list() {
+ fn python_list_pin() {
+     let context: TestContext = TestContext::new_with_versions(&["3.11", 
"3.12"])
+         .with_filtered_python_symlinks()
+-        .with_filtered_python_keys();
++        .with_filtered_python_keys()
++        .with_collapsed_whitespace();
+ 
+     // Pin to a version
+     uv_snapshot!(context.filters(), context.python_pin().arg("3.12"), @r###"
+@@ -146,8 +148,8 @@ fn python_list_pin() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -157,8 +159,8 @@ fn python_list_pin() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -171,7 +173,8 @@ fn python_list_venv() {
+         .with_filtered_python_keys()
+         .with_filtered_exe_suffix()
+         .with_filtered_python_names()
+-        .with_filtered_virtualenv_bin();
++        .with_filtered_virtualenv_bin()
++        .with_collapsed_whitespace();
+ 
+     // Create a virtual environment
+     uv_snapshot!(context.filters(), 
context.venv().arg("--python").arg("3.12").arg("-q"), @r###"
+@@ -187,8 +190,8 @@ fn python_list_venv() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -198,8 +201,8 @@ fn python_list_venv() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -285,7 +288,8 @@ fn python_list_unsupported_version() {
+ fn python_list_duplicate_path_entries() {
+     let context: TestContext = TestContext::new_with_versions(&["3.11", 
"3.12"])
+         .with_filtered_python_symlinks()
+-        .with_filtered_python_keys();
++        .with_filtered_python_keys()
++        .with_collapsed_whitespace();
+ 
+     // Construct a `PATH` with all entries duplicated
+     let path = std::env::join_paths(
+@@ -298,8 +302,8 @@ fn python_list_duplicate_path_entries() {
+     success: true
+     exit_code: 0
+     ----- stdout -----
+-    cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-    cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++    cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++    cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+     ----- stderr -----
+     ");
+@@ -320,8 +324,8 @@ fn python_list_duplicate_path_entries() {
+             success: true
+             exit_code: 0
+             ----- stdout -----
+-            cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]
+-            cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]
++            cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
++            cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
+ 
+             ----- stderr -----
+             ");
+@@ -341,8 +345,8 @@ fn python_list_duplicate_path_entries() {
+         success: true
+         exit_code: 0
+         ----- stdout -----
+-        cpython-3.12.[X]-[PLATFORM]     [PYTHON-3.12]-link/python3
+-        cpython-3.11.[X]-[PLATFORM]    [PYTHON-3.11]-link/python3
++        cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]-link/python3
++        cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]-link/python3
+ 
+         ----- stderr -----
+         ");

diff --git a/dev-python/uv/uv-0.6.13.ebuild b/dev-python/uv/uv-0.6.13.ebuild
index fa89cd13ee49..e98d57c5adae 100644
--- a/dev-python/uv/uv-0.6.13.ebuild
+++ b/dev-python/uv/uv-0.6.13.ebuild
@@ -88,6 +88,11 @@ pkg_setup() {
 }
 
 src_prepare() {
+       local PATCHES=(
+               # https://github.com/astral-sh/uv/pull/12851
+               "${FILESDIR}/${P}-test-ws.patch"
+       )
+
        default
 
        # force thin lto, makes build much faster and less memory hungry

Reply via email to