mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-18 03:13:48 +00:00
Respect exclusions in uv init (#5318)
## Summary Avoid adding to the workspace. Closes https://github.com/astral-sh/uv/issues/5254.
This commit is contained in:
parent
13dd8853d9
commit
2f768b8bb0
3 changed files with 84 additions and 15 deletions
|
|
@ -330,6 +330,21 @@ impl Workspace {
|
|||
&self.pyproject_toml
|
||||
}
|
||||
|
||||
/// Returns `true` if the path is excluded by the workspace.
|
||||
pub fn excludes(&self, project_path: &Path) -> Result<bool, WorkspaceError> {
|
||||
if let Some(workspace) = self
|
||||
.pyproject_toml
|
||||
.tool
|
||||
.as_ref()
|
||||
.and_then(|tool| tool.uv.as_ref())
|
||||
.and_then(|uv| uv.workspace.as_ref())
|
||||
{
|
||||
is_excluded_from_workspace(project_path, &self.install_path, workspace)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Collect the workspace member projects from the `members` and `excludes` entries.
|
||||
async fn collect_members(
|
||||
workspace_root: PathBuf,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue