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:
authorJon Turney <jon.turney@dronecode.org.uk>2022-09-01 23:01:54 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2022-10-02 14:57:11 +0300
commit6b43121c139e47641efe32f68333aae7909b9162 (patch)
tree54e428c28897f8118bafd6a8f7db48445235bd1b
parentde93bbcc131909111ec43ab5c0bdadf3131b9ab0 (diff)
Correctly linkify packages with a version-constraint
-rwxr-xr-xcalm/pkg2html.py6
-rw-r--r--test/testdata/htdocs.expected/summary/test-c.html2
2 files changed, 5 insertions, 3 deletions
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index f6a2ada..4924847 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -147,10 +147,12 @@ def update_package_listings(args, packages):
toremove = glob.glob(os.path.join(summaries, '*'))
- def linkify_package(p):
+ def linkify_package(pkg):
+ p = re.sub(r'(.*)\s+\(.*\)', r'\1', pkg)
if p in package_list:
pn = arch_package(packages, p).orig_name
- return '<a href="%s.html">%s</a>' % (p, pn)
+ text = re.sub(re.escape(p), pn, pkg)
+ return '<a href="%s.html">%s</a>' % (p, text)
logging.debug('package linkification failed for %s' % p)
return p
diff --git a/test/testdata/htdocs.expected/summary/test-c.html b/test/testdata/htdocs.expected/summary/test-c.html
index 2a0d186..200bd7b 100644
--- a/test/testdata/htdocs.expected/summary/test-c.html
+++ b/test/testdata/htdocs.expected/summary/test-c.html
@@ -13,7 +13,7 @@
<span class="detail">summary</span>: test package C<br><br>
<span class="detail">description</span>: test package C<br><br>
<span class="detail">categories</span>: Devel<br><br>
-<span class="detail">depends</span>: test-d (>= 1.0), <a href="test-e.html">test-e</a><br><br>
+<span class="detail">depends</span>: <a href="test-d.html">test-d (>= 1.0)</a>, <a href="test-e.html">test-e</a><br><br>
<span class="detail">obsoletes</span>: <a href="obs-a.html">obs-a</a>, <a href="obs-b.html">obs-b</a><br><br>
<span class="detail">source package</span>: <a href="test-c-src.html">test-c</a><br><br>
<span class="detail">maintainer(s)</span>: ORPHANED