doc/subarches.generated.txt: $(wildcard arch/*.py) doc/make_subarch_table_guidexml.py
./doc/make_subarch_table_guidexml.py
-doc/targets.generated.txt: doc/make_target_table.py $(wildcard modules/catalyst/targets/*.py)
+doc/targets.generated.txt: doc/make_target_table.py $(wildcard modules/*_target.py)
"./$<" > "$@"
clean:
#!/usr/bin/env python
# Copyright (C) 2012 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2012 Sebastian Pipping <sebastian@pippin.org>
# Licensed under GPL v2 or later
# This script should be run from the root of the catalyst source.
+from __future__ import print_function
+
import sys as _sys
_sys.path.insert(0, 'modules') # so we can find the `catalyst` module
-import catalyst.target as _catalyst_target
+import glob
+import re
if __name__ == '__main__':
- for module_name,module in sorted(_catalyst_target.get_targets().items()):
- if hasattr(module, '__target_map'):
- target_name = module.__target_map.keys()[0]
- print('`{}`;;'.format(target_name))
- # Replace blank lines with `+` (asciidoc list item continuation)
- print(module.__doc__.strip().replace('\n\n', '\n+\n'))
- print('')
+ extractor = re.compile('^modules/(([^ ]+)_target).py$')
+ for filename in sorted(glob.glob('modules/*_target.py')):
+ if 'generic' in filename:
+ continue
+
+ match = extractor.match(filename)
+ target_name = match.group(2).replace('_', '-')
+ module_name = match.group(1)
+
+ __import__(module_name)
+ module = _sys.modules[module_name]
+
+ print('`%s`;;' % target_name)
+ # Replace blank lines with `+` (asciidoc list item continuation)
+ print(module.__doc__.strip().replace('\n\n', '\n+\n'))
+ print('')