2 # This script generates a table of dependencies in HTML format on stdout.
3 # It expects to be run in the tahoe-lafs-dep-eggs directory.
7 extensions = ('.egg', '.tar.bz2', '.tar.gz', '.exe')
8 platform_aliases = [('i686','x86'), ('i386','x86'), ('i86pc','x86'), ('win32','windows-x86'),
9 ('win-amd64','windows-x86_64'), ('amd64','x86_64')]
10 python_versions = ((2,4), (2,5), (2,6), (2,7))
11 FILENAME_RE = re.compile(r'([a-zA-Z_0-9]*)-([0-9\.a-vx-z_]*)(-py[0-9\.]*)?(-.*)?')
12 FILENAME_RE2 = re.compile(r'([a-zA-Z_0-9]*)-([0-9\.a-vx-z_]*)(win32|win-amd64)?(-py[0-9\.]*)?')
17 if len(sys.argv) >= 1:
20 filenames = os.listdir(depdir)
28 for fname in filenames:
29 for ext in extensions:
30 if fname.endswith(ext):
31 m = FILENAME_RE.match(fname[:-len(ext)])
34 pythonver = (m.group(3) or '-py')[3:]
35 platform = (m.group(4) or '-')[1:]
36 except (IndexError, AttributeError, TypeError):
40 m = FILENAME_RE2.match(fname[:-len(ext)])
44 pythonver = (m.group(4) or '-py')[3:]
45 except (IndexError, AttributeError, TypeError):
48 for (alias, replacement) in platform_aliases:
49 if platform.endswith(alias):
50 platform = platform[:-len(alias)] + replacement
53 add(matrix, (pkg, platform), (pythonver, fname))
56 print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
59 print ' <meta http-equiv="Content-Type" content="text/html;charset=us-ascii">'
60 print ' <title>Software packages that Tahoe-LAFS depends on</title>'
63 print '<h2>Software packages that Tahoe-LAFS depends on</h2>'
65 print '<p>Packages that have compiled C/C++ code:</p>'
66 print '<table border="1">'
68 print ' <th colspan=2 style="background-color: #FFFFD0"> Package </th>'
69 for pyver in python_versions:
70 print ' <th style="background-color:#FFE8FF;"> Python %d.%d </th>' % pyver
73 platform_dependent_pkgs = set()
76 for (pkg, platform) in sorted(matrix):
78 platform_dependent_pkgs.add(pkg)
79 row_files = sorted(matrix[(pkg, platform)])
80 style1 = pkg != last_pkg and 'border-top: 2px solid #000000; background-color: #FFFFF0' or 'border: 0;'
81 style2 = pkg != last_pkg and 'border-top: 2px solid #000000; background-color: #FFFFF0' or 'background-color: #FFFFF0;'
82 style3 = pkg != last_pkg and 'border-top: 2px solid #000000;' or ''
84 print ' <th style="%s"> %s </th>' % (style1, pkg != last_pkg and pkg or '',)
85 print ' <td style="%s"> %s </td>' % (style2, platform,)
86 for pyver in python_versions:
87 files = [n for (v, n) in row_files if v == '%d.%d' % pyver]
88 print ' <td style="%s"> %s</td>' % (style3,
89 '<br> '.join(['<a href="%s">%s</a>' % (f, f) for f in files]))
95 print '<p>Packages that are platform-independent or source-only:</p>'
96 print '<table border="1">'
98 print ' <th style="background-color:#FFFFD0;"> Package </th>'
99 print ' <th style="background-color:#FFE8FF;"> All Python versions </th>'
102 style1 = 'border-top: 2px solid #000000; background-color:#FFFFF0;'
103 style2 = 'border-top: 2px solid #000000;'
104 for (pkg, platform) in sorted(matrix):
105 if pkg not in platform_dependent_pkgs:
107 print ' <th style="%s"> %s </th>' % (style1, pkg)
108 files = [n for (v, n) in sorted(matrix[(pkg, platform)]) if not v]
109 print ' <td style="%s"> %s</td>' % (style2, '<br> '.join(['<a href="%s">%s</a>' % (f, f) for f in files]))
114 # The document does validate, but not when it is included at the bottom of a directory listing.
116 #print '<a href="http://validator.w3.org/check?uri=referer" target="_blank"><img border="0" src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>'
117 print '</body></html>'