mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 06:17:50 +00:00
Update copy of gen-package-table.py in source tree.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
07aa5e76b5
commit
a2e116b330
@ -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)
|
||||
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> '.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%%"> Platform </th>' % (width,)
|
||||
for pkg in sorted(platform_dependent_pkgs):
|
||||
print ' <th style="background-color:#FFE8FF;" width="%d%%"> %s </th>' % (width, pkg)
|
||||
print ' <th style="background-color: #FFE8FF;" width="%d%%"> %s </th>' % (width, pkg)
|
||||
print ' </tr>'
|
||||
|
||||
first = True
|
||||
@ -114,13 +125,10 @@ for pyver in reversed(sorted(python_versions)):
|
||||
print ' <tr>'
|
||||
print ' <td style="%s"> %s </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"> %s</td>' % (style2,
|
||||
bestfile and '<a href="%s">%s</a>' % (bestfile, bestfile) or '')
|
||||
print ' <td style="%s"> %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"> %s </th>' % (style1, pkg)
|
||||
files = [n for (p, n) in m if pkg == p]
|
||||
print ' <td style="%s"> %s</td>' % (style2, '<br> '.join(['<a href="%s">%s</a>' % (f, f) for f in files]))
|
||||
print ' <td style="%s"> %s</td>' % (style2, file_list(m, pkg))
|
||||
print ' </tr>'
|
||||
|
||||
print '</table>'
|
||||
|
Loading…
Reference in New Issue
Block a user