Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'calm/pkg2html.py')
-rwxr-xr-xcalm/pkg2html.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index 2d6930e..d44b40b 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -50,6 +50,7 @@ import string
import sys
import textwrap
import time
+from typing import NamedTuple
import xtarfile
@@ -210,12 +211,22 @@ def update_package_listings(args, packages):
details_table['description'] = ldesc(po, bv)
details_table['categories'] = po.version_hints[bv].get('category', '')
+ class PackageData(NamedTuple):
+ is_attr: bool = False
+ summarize_limit: int = 0
+
if po.kind == package.Kind.source:
- details = ['build-depends']
+ details = {'build-depends': PackageData()}
else:
- details = ['depends', 'obsoletes', 'obsoleted_by', 'provides', 'conflicts']
-
- detail_is_attr = ['obsoleted_by']
+ details = {
+ 'depends': PackageData(),
+ 'obsoletes': PackageData(),
+ 'obsoleted_by': PackageData(is_attr=True),
+ 'provides': PackageData(),
+ 'conflicts': PackageData(),
+ 'rdepends': PackageData(is_attr=True, summarize_limit=10),
+ 'build_rdepends': PackageData(is_attr=True, summarize_limit=10)
+ }
for key in details:
# make the union of the package list for this detail
@@ -224,7 +235,7 @@ def update_package_listings(args, packages):
value = {}
values = set()
for arch in pos:
- if key in detail_is_attr:
+ if details[key].is_attr:
value[arch] = getattr(pos[arch], key, set())
else:
t = pos[arch].version_hints[pos[arch].best_version].get(key, None)
@@ -243,7 +254,11 @@ def update_package_listings(args, packages):
else:
detail.append(linkify_package(detail_pkg) + ' (%s)' % (','.join([arch for arch in pos if detail_pkg in value[arch]])))
- details_table[key] = ', '.join(detail)
+ limit = details[key].summarize_limit
+ if limit and len(detail) > limit:
+ details_table[key] = '<details><summary>(%s)</summary>%s</details>' % (len(detail), ', '.join(detail))
+ else:
+ details_table[key] = ', '.join(detail)
if po.kind == package.Kind.source:
es = p