From: Daira Hopwood <daira@jacaranda.org>
Date: Wed, 13 May 2015 12:36:04 +0000 (+0100)
Subject: Update copy of gen-package-table.py in source tree.
X-Git-Tag: allmydata-tahoe-1.10.1a1~9
X-Git-Url: https://git.rkrishnan.org/%5B/frontends//%22news.html/%22?a=commitdiff_plain;h=a2e116b330819d63d497b4dc3b740e285dab63a3;p=tahoe-lafs%2Ftahoe-lafs.git

Update copy of gen-package-table.py in source tree.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

diff --git a/misc/build_helpers/gen-package-table.py b/misc/build_helpers/gen-package-table.py
index 283daeb8..cd6bdc3c 100644
--- a/misc/build_helpers/gen-package-table.py
+++ b/misc/build_helpers/gen-package-table.py
@@ -9,6 +9,7 @@ extensions = ('.egg', '.tar.bz2', '.tar.gz', '.exe')
 platform_aliases = [('i686','x86'), ('i386','x86'), ('i86pc','x86'), ('win32','windows-x86'),
                     ('win-amd64','windows-x86_64'), ('amd64','x86_64')]
 min_supported_python = {'windows-x86': '2.7', 'windows-x86_64': '2.7'}
+pkg_name_continuations = ('modules')
 
 FILENAME_RE  = re.compile(r'([a-zA-Z_0-9\.]*)-([0-9\.a-vx-z_]*)(-py[0-9\.]*)?(-.*)?')
 FILENAME_RE2 = re.compile(r'([a-zA-Z_0-9\.]*)-([0-9\.a-vx-z_]*)(win32|win-amd64)?(-py[0-9\.]*)?')
@@ -18,11 +19,13 @@ pkgs = set()
 platform_dependent_pkgs = set()
 python_versions = set()
 
-depdir = '.'
+depdirs = ['.', '../tahoe-dep-sdists']
 if len(sys.argv) > 1:
-    depdir = sys.argv[1]
+    depdirs = sys.argv[1 :]
 
-filenames = os.listdir(depdir)
+filenames = set()
+for depdir in depdirs:
+    filenames = filenames.union(os.listdir(depdir))
 
 def add(d, k, v):
     if k in d:
@@ -36,12 +39,16 @@ for fname in filenames:
             m = FILENAME_RE.match(fname[:-len(ext)])
             try:
                 pkg       = m.group(1)
-                pythonver = (m.group(3) or '-py')[3:]
-                platform  = (m.group(4) or '-')[1:]
+                pkg2      = m.group(2)
+                if pkg2 in pkg_name_continuations:
+                    pkg += '-' + pkg2
+                else:
+                    pythonver = (m.group(3) or '-py')[3:]
+                    platform  = (m.group(4) or '-')[1:]
             except (IndexError, AttributeError, TypeError):
                 continue
 
-            if not pythonver:
+            if not pkg2 in pkg_name_continuations and not pythonver:
                 m = FILENAME_RE2.match(fname[:-len(ext)])
                 if m.group(3):
                     try:
@@ -66,7 +73,11 @@ for fname in filenames:
 
 platform_independent_pkgs = pkgs - platform_dependent_pkgs
 
-width = 100 / (len(platform_independent_pkgs) + 1)
+width = 100 / (len(platform_dependent_pkgs) + 1)
+
+def file_list(all_files, pkg):
+    files = sorted([(pkg_resources.parse_version(n), n) for (p, n) in all_files if pkg == p])
+    return '<br>&nbsp;'.join(['<a href="%s">%s</a>' % (f, f) for (v, f) in files])
 
 greybgstyle = '; background-color: #E0E0E0'
 nobgstyle = ''
@@ -91,7 +102,7 @@ for pyver in reversed(sorted(python_versions)):
         print '  <tr>'
         print '    <th style="background-color: #FFFFD0" width="%d%%">&nbsp;Platform&nbsp;</th>' % (width,)
         for pkg in sorted(platform_dependent_pkgs):
-            print '    <th style="background-color:#FFE8FF;" width="%d%%">&nbsp;%s&nbsp;</th>' % (width, pkg)
+            print '    <th style="background-color: #FFE8FF;" width="%d%%">&nbsp;%s&nbsp;</th>' % (width, pkg)
         print '  </tr>'
 
         first = True
@@ -114,13 +125,10 @@ for pyver in reversed(sorted(python_versions)):
             print '  <tr>'
             print '    <td style="%s">&nbsp;%s&nbsp;</td>' % (style1, annotated_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,
-                            bestfile and '<a href="%s">%s</a>' % (bestfile, bestfile) or '')
+                    print '    <td style="%s">&nbsp;%s</td>' % (style2, file_list(row_files, pkg))
             print '  </tr>'
             first = False
 
@@ -140,8 +148,7 @@ m = matrix['']['']
 for pkg in sorted(platform_independent_pkgs):
     print '  <tr>'
     print '    <th style="%s">&nbsp;%s&nbsp;</th>' % (style1, pkg)
-    files = [n for (p, n) in m if pkg == p]
-    print '    <td style="%s">&nbsp;%s</td>' % (style2, '<br>&nbsp;'.join(['<a href="%s">%s</a>' % (f, f) for f in files]))
+    print '    <td style="%s">&nbsp;%s</td>' % (style2, file_list(m, pkg))
     print '  </tr>'
 
 print '</table>'