diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-08-17 13:02:35 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-08-17 14:37:25 -0400 |
commit | c0d72bb7eed0aafc82762db7cd9a498eadf8b2b9 (patch) | |
tree | 85828bd9415b6bb4334f34d0d51cc68a36064d2a /docs/sphinx/source/analog/get_blocks.py | |
parent | dff90672879bf1ed9d3e083ba236fdd6ce29e168 (diff) |
docs: Reviving Python manual.
I'd like to only produce a single manual, and the Sphinx docs take too
much manual labor to keep up-to-date. Still, there is a lot of useful
tools and classes only in Python that need to be exposed in a manual,
so this is the quickest way to get there.
This flattens the sphinx documentation structure so each component has
a <component>_blocks.rst where the actual GNU Radio blocks are managed
and a <component>.rst for any other non-block or Python-only code
(hier_block2, functions, and classes).
The new flattened file structure should make it easier to update, but
the index.rst should have some work done to make structure information
better.
Diffstat (limited to 'docs/sphinx/source/analog/get_blocks.py')
-rw-r--r-- | docs/sphinx/source/analog/get_blocks.py | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/docs/sphinx/source/analog/get_blocks.py b/docs/sphinx/source/analog/get_blocks.py deleted file mode 100644 index f5fc902a8a..0000000000 --- a/docs/sphinx/source/analog/get_blocks.py +++ /dev/null @@ -1,106 +0,0 @@ -""" -This script regenerates the gnuradio.blocks sphinx source code. -""" - -from gnuradio import analog -import sys -import os - -doxyxml_location = os.path.abspath("../../../doxygen") -xml_location = os.path.abspath("../../../../build/docs/doxygen/xml/") -sys.path.append(doxyxml_location) - -from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, DoxyGroup -from doxyxml import DoxyOther, base - -class Block(object): - """ - Checks if doxyxml produced objects correspond to a new style - gnuradio block. - """ - - @classmethod - def includes(cls, item): - if not isinstance(item, DoxyClass): - return False - # Check for a parsing error. - if item.error(): - return False - is_a_block = item.has_member('make', DoxyFunction) and item.has_member('sptr', DoxyOther) - return is_a_block - -class Group(object): - """ - Checks if doxyxml produced objects correspond to a group. - """ - - @classmethod - def includes(cls, item): - if not isinstance(item, DoxyGroup): - return False - # Check for a parsing error. - if item.error(): - return False - return True - -def main(): - di = DoxyIndex(xml_location) - blocks = di.in_category(Block) - analog_blocks = [] - for block in blocks: - if block.name().startswith("gr::analog::"): - analog_blocks.append(block) - - all_grouped_blocks = [] - groups = di.in_category(Group) - groupinfo = [] - for group in groups: - contains_analog_blocks = False - block_list = [] - members = group.members() - for member in members: - if member.name().startswith("gr::analog"): - all_grouped_blocks.append(member) - if not contains_analog_blocks: - contains_analog_blocks = True - groupinfo.append((group.name(), group.title, block_list)) - block_list.append(member) - - for block in analog_blocks: - if block not in all_grouped_blocks: - print("Didn't find block {0}".format(block.name())) - - blockindex = ["""gnuradio.analog -=============== - -.. automodule:: gnuradio.analog"""] - for groupname, grouptitle, blocks in groupinfo: - blockindex.append("") - blockindex.append(grouptitle) - blockindex.append('-'*len(grouptitle)) - blockindex.append(""" -.. autosummary:: - :nosignatures: -""") - for block in blocks: - blockindex.append(" gnuradio.analog.{0}".format( - block.name()[len("gr::analog::"):])) - grouppage = [] - title = "gnuradio.analog: {0}".format(grouptitle) - grouppage.append(title) - grouppage.append('='*len(title)) - grouppage.append('') - for block in blocks: - shortname = block.name()[len("gr::analog::"):] - grouppage.append(".. autoblock:: gnuradio.analog.{0}".format(shortname)) - text = '\n'.join(grouppage) - f = open("{0}.rst".format(groupname), 'w') - f.write(text) - f.close() - text = "\n".join(blockindex) - f = open("index.rst", 'w') - f.write(text) - f.close() - -if __name__ == '__main__': - main() |