mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-22 00:02:32 +00:00
Remove workspace root for single-member workspace with uv export
(#7254)
## Summary If we have a single-member workspace, we actually don't write it to `members`. Closes https://github.com/astral-sh/uv/issues/7241.
This commit is contained in:
parent
e87d8e719d
commit
95a4beeed3
2 changed files with 39 additions and 2 deletions
|
@ -88,8 +88,9 @@ impl InstallOptions {
|
|||
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 {
|
||||
// If `--no-install-project` is set, remove the project itself. The project is always
|
||||
// part of the workspace.
|
||||
if (self.no_install_project || self.no_install_workspace) && package == project_name {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -821,5 +821,41 @@ fn no_emit() -> Result<()> {
|
|||
Resolved 6 packages in [TIME]
|
||||
"###);
|
||||
|
||||
// Remove the member.
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
[project]
|
||||
name = "project"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = ["anyio==3.7.0"]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=42"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
"#,
|
||||
)?;
|
||||
|
||||
// Exclude the workspace.
|
||||
uv_snapshot!(context.filters(), context.export().arg("--no-emit-workspace"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated via `uv export`.
|
||||
anyio==3.7.0 \
|
||||
--hash=sha256:275d9973793619a5374e1c89a4f4ad3f4b0a5510a2b5b939444bee8f4c4d37ce \
|
||||
--hash=sha256:eddca883c4175f14df8aedce21054bfca3adb70ffe76a9f607aef9d7fa2ea7f0
|
||||
idna==3.6 \
|
||||
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
|
||||
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
|
||||
sniffio==1.3.1 \
|
||||
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc \
|
||||
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2
|
||||
|
||||
----- stderr -----
|
||||
Resolved 4 packages in [TIME]
|
||||
"###);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue