Hi list,
I recently compiled gr-howto-write-a-block (from git master) and its
doxygen documentation is not loaded/displayed in gnuradio-companion.
The python code is installed in "${GR_PYTHON_DIR}/howto". See:
http://gnuradio.org/cgit/gnuradio.git/tree/gr-howto-write-a-block/python/CMakeLists.txt#n34
http://gnuradio.org/cgit/gnuradio.git/tree/gr-howto-write-a-block/swig/CMakeLists.txt#n51
In gnuradio-companion, when the python documentation is loaded, it
is assumed the blocks are in the "gnuradio" subpackage. See:
http://gnuradio.org/cgit/gnuradio.git/tree/grc/python/extract_docs.py#n32
In case I didn't miss something, what is the preferred way to fix
this ? (I say "fix" because I would expect the howto block to show
its doc in grc by default).
Solution 1: install third party blocks into the "gnuradio" package
(i.e. installing to "${GR_PYTHON_DIR}/gnuradio/howto").
Solution 2: modify gnuradio-companion so it can search outside the
"gnuradio" package. For testing purposes, I made the attached patch.
Regards,
-- Julien Olivain.
diff --git a/grc/python/extract_docs.py b/grc/python/extract_docs.py
index a7e945c..33c4043 100644
--- a/grc/python/extract_docs.py
+++ b/grc/python/extract_docs.py
@@ -31,7 +31,13 @@ def _extract(key):
module_name, constructor_name = key.split('_', 1)
module = __import__('gnuradio.'+module_name)
module = getattr(module, module_name)
- except: return ''
+ except ImportError:
+ try:
+ module_name, constructor_name = key.split('_', 1)
+ module = __import__(module_name)
+ except: return ''
+ except:
+ return ''
pattern = constructor_name.replace('_', '_*').replace('x', '\w')
pattern_matcher = re.compile('^%s\w*$'%pattern)
matches = filter(lambda x: pattern_matcher.match(x), dir(module))
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio