summaryrefslogtreecommitdiff
path: root/grc/src/platforms/python
diff options
context:
space:
mode:
authorjblum2009-05-29 06:43:35 +0000
committerjblum2009-05-29 06:43:35 +0000
commit693cf2facf18c95db1559b035b09137f0fc191e6 (patch)
tree7358d2beb562e32fb65bbe96185f79eac62c95bd /grc/src/platforms/python
parentefc3d118fe6e2386da9cf3d8a4a09df0efa749b1 (diff)
downloadgnuradio-693cf2facf18c95db1559b035b09137f0fc191e6.tar.gz
gnuradio-693cf2facf18c95db1559b035b09137f0fc191e6.tar.bz2
gnuradio-693cf2facf18c95db1559b035b09137f0fc191e6.zip
Did a little work with path handling.
Additional blocks paths can be specified with environment variable GRC_BLOCKS_PATH git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11163 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/src/platforms/python')
-rw-r--r--grc/src/platforms/python/Platform.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/grc/src/platforms/python/Platform.py b/grc/src/platforms/python/Platform.py
index 9b0b3bb30..d2bb4627e 100644
--- a/grc/src/platforms/python/Platform.py
+++ b/grc/src/platforms/python/Platform.py
@@ -30,25 +30,22 @@ from Constants import \
BLOCK_TREE, DEFAULT_FLOW_GRAPH, \
BLOCKS_DIR
+_critical_blocks_only = map(lambda b: os.path.join(BLOCKS_DIR, b), ['options.xml', 'usrp_probe.xml', 'usrp2_probe.xml'])
+
class Platform(_Platform):
- def __init__(self, block_paths_internal_only=[], block_paths_external=[]):
+ def __init__(self, extra_blocks=[], critical_only=False):
"""
Make a platform for gnuradio.
- The internal only list will replace the current block path.
- @param block_paths_internal_only a list of blocks internal to this platform
- @param block_paths_external a list of blocks to load in addition to the above blocks
+ @param extra_blocks a list of block paths to load in addition to main block library
+ @param critical_only only load critical blocks (used only for usrp probe scripts to speed up load time)
"""
#ensure hier dir
if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR)
- #handle internal/only
- if block_paths_internal_only:
- block_paths = map(lambda b: os.path.join(BLOCKS_DIR, b), ['options.xml'] + block_paths_internal_only)
- else: block_paths = [BLOCKS_DIR]
- #handle external
- block_paths.extend(block_paths_external)
- #append custom hiers
- block_paths.append(HIER_BLOCKS_LIB_DIR)
+ if critical_only: block_paths = _critical_blocks_only
+ else: block_paths = extra_blocks + [HIER_BLOCKS_LIB_DIR, BLOCKS_DIR]
+ #convert block paths to absolute paths, ensure uniqueness
+ block_paths = set(map(os.path.abspath, block_paths))
#init
_Platform.__init__(
self,