Fix typo in e-mail address
[catalyst.git] / doc / make_target_table.py
1 #!/usr/bin/env python
2 # Copyright (C) 2012 W. Trevor King <wking@drexel.edu>
3 # Copyright (C) 2012 Sebastian Pipping <sebastian@pipping.org>
4 # Licensed under GPL v2 or later
5
6 # This script should be run from the root of the catalyst source.
7
8 from __future__ import print_function
9
10 import sys as _sys
11
12 _sys.path.insert(0, 'modules')  # so we can find the `catalyst` module
13
14 import glob
15 import re
16
17
18 def key_netboot_before_netboot2((target_name, module)):
19         return target_name + '1'
20
21
22 if __name__ == '__main__':
23         extractor = re.compile('^modules/(([^ ]+)_target).py$')
24         targets = list()
25         for filename in sorted(glob.glob('modules/*_target.py')):
26                 if 'generic' in filename:
27                         continue
28
29                 match = extractor.match(filename)
30                 target_name = match.group(2).replace('_', '-')
31                 module_name = match.group(1)
32
33                 __import__(module_name)
34                 module = _sys.modules[module_name]
35
36                 targets.append((target_name, module))
37
38         for target_name, module in sorted(targets, key=key_netboot_before_netboot2):
39                 print('`%s`;;' % target_name)
40                 # Replace blank lines with `+` (asciidoc list item continuation)
41                 print(module.__doc__.strip().replace('\n\n', '\n+\n'))
42                 print('')