mirror of https://github.com/astral-sh/uv
Remove `tool.uv.sources` table if it is empty (#8365)
## Summary Resolves #8362
This commit is contained in:
parent
4355392c82
commit
ca55793a90
|
|
@ -539,6 +539,20 @@ impl PyProjectTomlMut {
|
|||
{
|
||||
if let Some(key) = find_source(name, sources) {
|
||||
sources.remove(&key);
|
||||
|
||||
// Remove the `tool.uv.sources` table if it is empty.
|
||||
if sources.is_empty() {
|
||||
self.doc
|
||||
.entry("tool")
|
||||
.or_insert(implicit())
|
||||
.as_table_mut()
|
||||
.ok_or(Error::MalformedSources)?
|
||||
.entry("uv")
|
||||
.or_insert(implicit())
|
||||
.as_table_mut()
|
||||
.ok_or(Error::MalformedSources)?
|
||||
.remove("sources");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1688,8 +1688,6 @@ fn add_remove_workspace() -> Result<()> {
|
|||
[build-system]
|
||||
requires = ["setuptools>=42"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.uv.sources]
|
||||
"###
|
||||
);
|
||||
});
|
||||
|
|
@ -2881,8 +2879,6 @@ fn remove_non_normalized_source() -> Result<()> {
|
|||
[build-system]
|
||||
requires = ["setuptools>=42"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.uv.sources]
|
||||
"###
|
||||
);
|
||||
});
|
||||
|
|
@ -4614,8 +4610,6 @@ fn remove_repeated() -> Result<()> {
|
|||
|
||||
[tool.uv]
|
||||
dev-dependencies = ["anyio"]
|
||||
|
||||
[tool.uv.sources]
|
||||
"###
|
||||
);
|
||||
});
|
||||
|
|
@ -4648,8 +4642,6 @@ fn remove_repeated() -> Result<()> {
|
|||
|
||||
[tool.uv]
|
||||
dev-dependencies = ["anyio"]
|
||||
|
||||
[tool.uv.sources]
|
||||
"###
|
||||
);
|
||||
});
|
||||
|
|
@ -4685,8 +4677,6 @@ fn remove_repeated() -> Result<()> {
|
|||
|
||||
[tool.uv]
|
||||
dev-dependencies = []
|
||||
|
||||
[tool.uv.sources]
|
||||
"###
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue