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
6 # This script should be run from the root of the catalyst source.
8 from __future__ import print_function
12 _sys.path.insert(0, 'modules') # so we can find the `catalyst` module
18 def key_netboot_before_netboot2((target_name, module)):
19 return target_name + '1'
22 if __name__ == '__main__':
23 extractor = re.compile('^modules/(([^ ]+)_target).py$')
25 for filename in sorted(glob.glob('modules/*_target.py')):
26 if 'generic' in filename:
29 match = extractor.match(filename)
30 target_name = match.group(2).replace('_', '-')
31 module_name = match.group(1)
33 __import__(module_name)
34 module = _sys.modules[module_name]
36 targets.append((target_name, module))
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'))