From 5cb7b0d906e0993306652cf595183013b0e7d171 Mon Sep 17 00:00:00 2001 From: messense Date: Wed, 1 Nov 2023 22:46:43 +0800 Subject: [PATCH] Try to fix windows test failure --- Cargo.lock | 1 + Cargo.toml | 1 + src/source_distribution.rs | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index fb66e5eaa..5aaf59dcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1090,6 +1090,7 @@ dependencies = [ "native-tls", "normpath", "once_cell", + "path-slash", "pep440_rs", "pep508_rs", "platform-info", diff --git a/Cargo.toml b/Cargo.toml index 6bac735fc..280efb7bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,6 +71,7 @@ lddtree = "0.3.3" cc = "1.0.72" dunce = "1.0.2" normpath = "1.0.0" +path-slash = "0.2.1" pep440_rs = { version = "0.3.6", features = ["serde"] } pep508_rs = { version = "0.2.1", features = ["serde"] } time = "0.3.17" diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 230d13948..8cf4dd492 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -6,6 +6,7 @@ use cargo_metadata::{Metadata, MetadataCommand}; use fs_err as fs; use ignore::overrides::Override; use normpath::PathExt as _; +use path_slash::PathExt as _; use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::process::Command; @@ -455,8 +456,16 @@ fn add_cargo_package_files_to_sdist( let relative_workspace_cargo_toml = relative_cargo_lock.with_file_name("Cargo.toml"); let mut deps_to_keep = known_path_deps.clone(); // Also need to the main Python binding crate + let workspace_root_slash = PathBuf::from( + workspace_root + .to_path_buf() + .into_std_path_buf() + .to_slash() + .unwrap() + .as_ref(), + ); let main_member_name = abs_manifest_dir - .strip_prefix(workspace_root) + .strip_prefix(workspace_root_slash) .unwrap() .to_str() .unwrap()