mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-24 05:17:05 +00:00
Add --no-emit-project and friends to uv export (#7110)
## Summary Like `uv sync`, you can omit the current project (`--no-emit-project`), a specific package (`--no-emit-package`), or the entire workspace (`--no-emit-workspace`). Closes https://github.com/astral-sh/uv/issues/6960. Closes #6995.
This commit is contained in:
parent
d0f9016eda
commit
6ae005b0d0
8 changed files with 231 additions and 21 deletions
|
|
@ -80,4 +80,29 @@ impl InstallOptions {
|
|||
|
||||
resolution.filter(|dist| !no_install_packages.contains(dist.name()))
|
||||
}
|
||||
|
||||
/// Returns `true` if a package passes the install filters.
|
||||
pub fn include_package(
|
||||
&self,
|
||||
package: &PackageName,
|
||||
project_name: &PackageName,
|
||||
members: &BTreeSet<PackageName>,
|
||||
) -> bool {
|
||||
// If `--no-install-project` is set, remove the project itself.
|
||||
if self.no_install_project && package == project_name {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If `--no-install-workspace` is set, remove the project and any workspace members.
|
||||
if self.no_install_workspace && members.contains(package) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If `--no-install-package` is provided, remove the requested packages.
|
||||
if self.no_install_package.contains(package) {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue