conandeps: list every parent path in the via column

A package required by several others now gets one line per direct parent
(shortest path to that parent, shortest first) instead of a "(+N)" count.
The text table helper supports multi-line cells; HTML uses <br>.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYNdaGDrpaqDyT8QtrTQbM
This commit is contained in:
Ole-Morten Duesund 2026-08-25 15:42:22 +02:00
commit 4b084f8bae
4 changed files with 70 additions and 30 deletions

View file

@ -242,8 +242,10 @@ def test_sorted_by_path(report):
("libbar/1.1", ["libfoo"]),
("libdeep/1.0", ["libfoo", "libbar"]),
]
# libqux is required by both the consumer and libbaz -> two parents.
# libqux is required by both the consumer and libbaz -> two parents, but
# it is direct, so the via column just says "-".
assert sorted(report.deps["libqux#host"].parents) == ["libbaz", "your conanfile"]
assert conandeps._via(report.deps["libqux#host"]) == "-"
text = conandeps.render_text(report)
assert re.search(r"hdr/1\.0\s+-\s+host", text)
assert re.search(r"libbar/1\.1\s+libfoo\s+host", text)
@ -253,6 +255,24 @@ def test_sorted_by_path(report):
assert "<td>libdeep/1.0</td><td>libfoo \u2192 libbar</td><td>host</td>" in page
def test_via_lists_every_parent_path():
boost = conandeps.Dep(ref="boost/1.8", context="host", depth=2, path=["MyDepA"])
boost.parents = ["MyDepA", "Zigma"]
boost.paths = [["MyDepA"], ["MyDepB", "Zigma"]]
assert conandeps._via(boost) == "MyDepA\nMyDepB -> Zigma"
assert conandeps._via(boost, " > ", "; ") == "MyDepA; MyDepB > Zigma"
# Multi-line cells spread the row; other columns stay aligned and blank.
lines = conandeps._table(
["package", "via", "ctx"],
[["boost/1.8", conandeps._via(boost), "host"]],
conandeps._Palette(False),
)
assert lines[2:] == [
"boost/1.8 MyDepA host",
" MyDepB -> Zigma",
]
def test_missing_binaries(report):
missing = {d.ref: d.missing() for d in report.deps.values() if d.missing()}
assert missing == {"libbar/1.1": ["Debug", "RelWithDebInfo"]}