Capture portable path serialization in a struct (#5652)

## Summary

I need to reuse this in #5494, so want to abstract it out and make it
reusable.
This commit is contained in:
Charlie Marsh 2024-07-31 12:00:37 -04:00 committed by GitHub
parent 8d14a4cb4f
commit dfec262586
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 169 additions and 79 deletions

View file

@ -2,11 +2,11 @@ use std::path::Path;
use std::str::FromStr;
use std::{fmt, mem};
use path_slash::PathExt;
use thiserror::Error;
use toml_edit::{Array, DocumentMut, Item, RawString, Table, TomlError, Value};
use pep508_rs::{ExtraName, PackageName, Requirement, VersionOrUrl};
use uv_fs::PortablePath;
use crate::pyproject::{DependencyType, PyProjectToml, Source};
@ -65,8 +65,7 @@ impl PyProjectTomlMut {
.ok_or(Error::MalformedWorkspace)?;
// Add the path to the workspace.
// Use cross-platform slashes so the toml string type does not change
members.push(path.as_ref().to_slash_lossy().to_string());
members.push(PortablePath::from(path.as_ref()).to_string());
Ok(())
}