From cde210bac7e4e9bef14ad8c823b3adc09d399934 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 3 Dec 2024 22:52:25 +0800 Subject: [PATCH] Improve python source path normalization error message Closes #2363 --- src/project_layout.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/project_layout.rs b/src/project_layout.rs index 278722904..a4e46416a 100644 --- a/src/project_layout.rs +++ b/src/project_layout.rs @@ -144,7 +144,16 @@ impl ProjectResolver { .unwrap_or_default() .to_vec(); let py_root = match pyproject.and_then(|x| x.python_source()) { - Some(py_src) => project_root.join(py_src).normalize()?.into_path_buf(), + Some(py_src) => project_root + .join(py_src) + .normalize() + .with_context(|| { + format!( + "Failed to normalize python source path `{}`", + py_src.display() + ) + })? + .into_path_buf(), None => match pyproject.and_then(|x| x.project_name()) { Some(project_name) => { // Detect src layout