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

remove "why" information from build-order files #313

Merged
merged 1 commit into from
Aug 12, 2024
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
7 changes: 0 additions & 7 deletions src/fromager/commands/build_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sys

import click
from packaging.requirements import Requirement

from .. import clickext, overrides

Expand Down Expand Up @@ -42,7 +41,6 @@ def as_csv(build_order_file: str, output: pathlib.Path | None) -> None:
("type", "Dependency Type"),
("prebuilt", "Pre-built Package"),
("order", "Build Order"),
("why", "Dependency Chain"),
]
headers = {n: v for n, v in fields}
fieldkeys = [f[0] for f in fields]
Expand All @@ -57,11 +55,6 @@ def as_csv(build_order_file: str, output: pathlib.Path | None) -> None:
# Replace the short keys with the longer human-readable
# headers we want in the CSV output.
new_entry = {headers[f]: entry[f] for f in fieldkeys}
# Reformat the why field
new_entry["Dependency Chain"] = " ".join(
f"-{dep_type}-> {Requirement(req).name}({version})"
for dep_type, req, version in entry["why"]
)
build_order.append(new_entry)

outfile = open(output, "w") if output else sys.stdout
Expand Down
2 changes: 0 additions & 2 deletions src/fromager/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def add_to_build_order(
req_type: str,
req: Requirement,
version: Version,
why: list[typing.Any],
source_url: str,
source_url_type: str,
prebuilt: bool = False,
Expand All @@ -120,7 +119,6 @@ def add_to_build_order(
"constraint": str(constraint) if constraint else "",
"dist": canonicalize_name(req.name),
"version": str(version),
"why": why,
"prebuilt": prebuilt,
"source_url": source_url,
"source_url_type": source_url_type,
Expand Down
1 change: 0 additions & 1 deletion src/fromager/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def handle_requirement(
req_type=req_type,
req=req,
version=resolved_version,
why=why,
source_url=source_url,
source_url_type=source_url_type,
prebuilt=pre_built,
Expand Down
43 changes: 10 additions & 33 deletions tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,18 @@ def test_seen_name_canonicalization(tmp_context):

def test_build_order(tmp_context):
tmp_context.add_to_build_order(
"build_backend",
Requirement("buildme>1.0"),
"6.0",
[("toplevel", Requirement("buildme>1.0"), "6.0")],
"url",
"sdist",
req_type="build_backend",
req=Requirement("buildme>1.0"),
version="6.0",
source_url="url",
source_url_type="sdist",
)
tmp_context.add_to_build_order(
"dependency",
Requirement("testdist>1.0"),
"1.2",
[
("toplevel", Requirement("buildme>1.0"), "6.0"),
("install", Requirement("testdist>1.0"), "1.0"),
],
"url",
"sdist",
req_type="dependency",
req=Requirement("testdist>1.0"),
version="1.2",
source_url="url",
source_url_type="sdist",
)
contents_str = tmp_context._build_order_filename.read_text()
contents = json.loads(contents_str)
Expand All @@ -64,9 +59,6 @@ def test_build_order(tmp_context):
"source_url": "url",
"source_url_type": "sdist",
"constraint": "",
"why": [
["toplevel", "buildme>1.0", "6.0"],
],
},
{
"type": "dependency",
Expand All @@ -77,10 +69,6 @@ def test_build_order(tmp_context):
"source_url": "url",
"source_url_type": "sdist",
"constraint": "",
"why": [
["toplevel", "buildme>1.0", "6.0"],
["install", "testdist>1.0", "1.0"],
],
},
]
assert expected == contents
Expand All @@ -91,23 +79,20 @@ def test_build_order_repeats(tmp_context):
"build_backend",
Requirement("buildme>1.0"),
"6.0",
[("toplevel", Requirement("buildme>1.0"), "6.0")],
"url",
"sdist",
)
tmp_context.add_to_build_order(
"build_backend",
Requirement("buildme>1.0"),
"6.0",
[("toplevel", Requirement("buildme>1.0"), "6.0")],
"url",
"sdist",
)
tmp_context.add_to_build_order(
"build_backend",
Requirement("buildme[extra]>1.0"),
"6.0",
[("toplevel", Requirement("buildme[extra]>1.0"), "6.0")],
"url",
"sdist",
)
Expand All @@ -123,9 +108,6 @@ def test_build_order_repeats(tmp_context):
"source_url": "url",
"source_url_type": "sdist",
"constraint": "",
"why": [
["toplevel", "buildme>1.0", "6.0"],
],
},
]
assert expected == contents
Expand All @@ -136,15 +118,13 @@ def test_build_order_name_canonicalization(tmp_context):
"build_backend",
Requirement("flit-core>1.0"),
"3.9.0",
[("build_backend", Requirement("flit-core>1.0"), "3.9.0")],
"url",
"sdist",
)
tmp_context.add_to_build_order(
"build_backend",
Requirement("flit_core>1.0"),
"3.9.0",
[("build_backend", Requirement("flit-core>1.0"), "3.9.0")],
"url",
"sdist",
)
Expand All @@ -160,9 +140,6 @@ def test_build_order_name_canonicalization(tmp_context):
"source_url": "url",
"source_url_type": "sdist",
"constraint": "",
"why": [
["build_backend", "flit-core>1.0", "3.9.0"],
],
},
]
assert expected == contents
Loading