Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not report path dependencies by default #503

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions dependency_management/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ def build_koji_repo_dict(crates, release):
return koji_repo_dict


def build_cargo_metadata(manifest_path):
def build_cargo_metadata(manifest_path, *, skip_path=False):
"""
Build a dict mapping crate to version spec from Cargo.toml.

:param manifest_path: the path to the Cargo manifest file
:type manifest_path: str or NoneType
:param bool skip_path: if True, skip path dependencies
:returns: a dict mapping crate name to version specification
:rtype: str * SimpleSpec
"""
Expand All @@ -180,10 +181,10 @@ def build_cargo_metadata(manifest_path):
package = packages[0]
dependencies = package["dependencies"]

result = {}
for item in dependencies:
# cargo-metadata insert spaces into "req" value; SimpleSpec constructor
# rejects specifications that contain spaces.
result[item["name"]] = SimpleSpec(item["req"].replace(" ", ""))

return result
# cargo-metadata insert spaces into "req" value; SimpleSpec constructor
# rejects specifications that contain spaces.
return {
item["name"]: SimpleSpec(item["req"].replace(" ", ""))
for item in dependencies
if not skip_path or not "path" in item
}
13 changes: 12 additions & 1 deletion dependency_management/compare_fedora_versions
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ def main():
help=help_text,
)

help_text = "Do not ignore path dependencies"
parser.add_argument(
"--deny-path",
action="store_true",
dest="deny_path",
default=False,
help=help_text,
)

help_text = "Allow partial version expressions in Cargo.toml (example 0.14)"
parser.add_argument(
"--allow-partial-versions",
Expand Down Expand Up @@ -196,7 +205,9 @@ def main():
)

# Read the dependency versions specified in Cargo.toml
explicit_dependencies = build_cargo_metadata(args.manifest_path)
explicit_dependencies = build_cargo_metadata(
args.manifest_path, skip_path=not args.deny_path
)

# Build koji dict
try:
Expand Down