mirror of
https://github.com/servo/servo
synced 2026-05-05 06:32:13 +02:00
Cargo.toml: More publish preparation (#43457)
Add further missing repository keys / descriptions, which I missed in #43451 due to a suboptimal grep (assuming that rust-version.workspace is always the last item). Additionally fix crate self-references, which caused cargo-publish to fail, due to it trying to fetch the crate from crates.io. When specifying the current crate in `[dev-dependencies]` to enable a test feature or similar, apparently one should not use `workspace = true` and instead use `path`. This requires extending the previously added `tidy` check, to allow `path` dependencies in this specific case outside of the workspace Cargo.toml. Testing: Covered by existing tests --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
56e79459f2
commit
a6b479d2cc
@@ -565,13 +565,22 @@ def check_toml(file_name: str, lines: list[bytes]) -> Iterator[tuple[int, str]]:
|
||||
|
||||
|
||||
def path_dependency_names(cargo_toml: dict[str, Any]) -> list[str]:
|
||||
"""Scan a Cargo.toml dict for any dependencies using `path =`."""
|
||||
"""Scan a Cargo.toml dict for any dependencies using `path =`.
|
||||
|
||||
Entries that reference the own manifest are ignored.
|
||||
"""
|
||||
path_dependencies = []
|
||||
manifest_package_name = cargo_toml.get("package", {}).get("name")
|
||||
for dependency_table in dependency_tables(cargo_toml):
|
||||
# dependency_value is everything in `{}` of `dependency_name = { ... }`
|
||||
for dependency_name, dependency_value in dependency_table.items():
|
||||
if "path" in dependency_value:
|
||||
path_dependencies.append(dependency_name)
|
||||
# When self-referencing the own package from within a packages manifest,
|
||||
# we must use `path`, otherwise cargo will try to resolve from crates.io.
|
||||
# This pattern is commonly used to enable extra code (features) in a library for integration tests.
|
||||
dep_package_name = dependency_value.get("package", "")
|
||||
if manifest_package_name != dependency_name and manifest_package_name != dep_package_name:
|
||||
path_dependencies.append(dependency_name)
|
||||
return path_dependencies
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user