From a2e116b330819d63d497b4dc3b740e285dab63a3 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Wed, 13 May 2015 13:36:04 +0100 Subject: [PATCH] Update copy of gen-package-table.py in source tree. Signed-off-by: Daira Hopwood --- misc/build_helpers/gen-package-table.py | 35 +++++++++++++++---------- 1 file changed, 21 insertions(+), 14 deletions(-) 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 '
 '.join(['%s' % (f, f) for (v, f) in files]) greybgstyle = '; background-color: #E0E0E0' nobgstyle = '' @@ -91,7 +102,7 @@ for pyver in reversed(sorted(python_versions)): print ' ' print '  Platform ' % (width,) for pkg in sorted(platform_dependent_pkgs): - print '  %s ' % (width, pkg) + print '  %s ' % (width, pkg) print ' ' first = True @@ -114,13 +125,10 @@ for pyver in reversed(sorted(python_versions)): print ' ' print '  %s ' % (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 ' n/a ' % (style2,) else: - print '  %s' % (style2, - bestfile and '%s' % (bestfile, bestfile) or '') + print '  %s' % (style2, file_list(row_files, pkg)) print ' ' first = False @@ -140,8 +148,7 @@ m = matrix[''][''] for pkg in sorted(platform_independent_pkgs): print ' ' print '  %s ' % (style1, pkg) - files = [n for (p, n) in m if pkg == p] - print '  %s' % (style2, '
 '.join(['%s' % (f, f) for f in files])) + print '  %s' % (style2, file_list(m, pkg)) print ' ' print '' -- 2.45.2