mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-24 21:29:49 +00:00
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:
parent
8d14a4cb4f
commit
dfec262586
9 changed files with 169 additions and 79 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue