aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2012-07-09 17:02:12 +0200
committerSebastian Pipping <sebastian@pipping.org>2012-07-09 17:14:18 +0200
commit0740316bd2f35d297f02b08e219765272ecc6822 (patch)
treef5d29bf24e5338d94558490d7228a6d76a925945 /doc
parentMan page: fix typo "athalon-xp" (diff)
downloadcatalyst-0740316bd2f35d297f02b08e219765272ecc6822.tar.gz
catalyst-0740316bd2f35d297f02b08e219765272ecc6822.tar.bz2
catalyst-0740316bd2f35d297f02b08e219765272ecc6822.zip
Migrate doc/make_target_table.py to Catalyst 2.x and Python 2.x
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/make_target_table.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/doc/make_target_table.py b/doc/make_target_table.py
index 1bacbe28..b72935fa 100755
--- a/doc/make_target_table.py
+++ b/doc/make_target_table.py
@@ -1,21 +1,34 @@
#!/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('')