Commit 04d1c81d authored by Kevin Morris's avatar Kevin Morris
Browse files

bugfix: fix extra dependency annotations



These were being displayed regardless of the dep type
and state of DepDesc. This is fixed with this commit.

Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 88569b6d
Pipeline #9979 passed with stage
in 2 minutes and 48 seconds
......@@ -46,6 +46,8 @@ def dep_extra(dep: PackageDependency) -> str:
@register_filter("dep_extra_desc")
def dep_extra_desc(dep: PackageDependency) -> str:
extra = dep_extra(dep)
if not dep.DepDesc:
return extra
return extra + f" – {dep.DepDesc}"
......
......@@ -16,9 +16,11 @@
</a>
{% endif %}
{{ dep.Package | provides_list(dep.DepName) | safe }}
{% set extra = dep | dep_extra %}
{% if extra %}
<!-- If this dependency type is an optdepends (id: 4). -->
{% if dep.DepTypeID == 4 %}
<em>{{ dep | dep_extra_desc }}</em>
{% else %}
<em>{{ dep | dep_extra }}</em>
{% endif %}
</li>
{% endfor %}
......
......@@ -247,7 +247,15 @@ def test_package_dependencies(client: TestClient, maintainer: User,
dep_type_name="optdepends",
autocommit=False)
broken_dep = create_package_dep(package, "test-dep-5",
# Heh. Another optdepends to test one with a description.
opt_desc_dep_pkg = create_package("test-dep-5", maintainer,
autocommit=False)
opt_desc_dep = create_package_dep(package, opt_desc_dep_pkg.Name,
dep_type_name="optdepends",
autocommit=False)
opt_desc_dep.DepDesc = "Test description."
broken_dep = create_package_dep(package, "test-dep-6",
dep_type_name="depends",
autocommit=False)
......@@ -273,6 +281,7 @@ def test_package_dependencies(client: TestClient, maintainer: User,
make_dep.DepName,
check_dep.DepName,
opt_dep.DepName,
opt_desc_dep.DepName,
official_dep.DepName
]
pkgdeps = root.findall('.//ul[@id="pkgdepslist"]/li/a')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment