From f606ce068bac906f976736755c5497a093a1d134 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Fri, 19 Nov 2010 21:39:05 -0800
Subject: [PATCH] misc: gen-package-table: show only the highest-numbered
 package for each platform and each library

---
 misc/build_helpers/gen-package-table.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc/build_helpers/gen-package-table.py b/misc/build_helpers/gen-package-table.py
index 505ecbf0..e0c50b3f 100644
--- a/misc/build_helpers/gen-package-table.py
+++ b/misc/build_helpers/gen-package-table.py
@@ -3,6 +3,7 @@
 # It expects to be run in the tahoe-lafs-dep-eggs directory.
 
 import re, os, sys
+import pkg_resources
 
 extensions = ('.egg', '.tar.bz2', '.tar.gz', '.exe')
 platform_aliases = [('i686','x86'), ('i386','x86'), ('i86pc','x86'), ('win32','windows-x86'),
@@ -93,11 +94,12 @@ for pyver in reversed(sorted(python_versions)):
             print '    <td style="%s">&nbsp;%s&nbsp;</td>' % (style1, platform,)
             for pkg in sorted(platform_dependent_pkgs):
                 files = [n for (p, n) in row_files if pkg == p]
+                bestfile = files and max([(pkg_resources.parse_version(x), x) for x in files])[1] or None
                 if pkg == 'pywin32' and not platform.startswith('windows'):
                     print '    <td style="border: 0; text-align: center; %s"> n/a </td>' % (style2,)
                 else:
                     print '    <td style="%s">&nbsp;%s</td>' % (style2,
-                            '<br>&nbsp;'.join(['<a href="%s">%s</a>' % (f, f) for f in files]))
+                            bestfile and '<a href="%s">%s</a>' % (bestfile, bestfile) or '')
             print '  </tr>'
             first = False
 
-- 
2.45.2