summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
authorjblum2008-09-14 02:43:47 +0000
committerjblum2008-09-14 02:43:47 +0000
commit4e8ef6dcae31586376986145f95689b70bc748e5 (patch)
tree9cea91c5c4de0dac36ce647a7b2f27f72116baf9 /grc
parentc4b73c460d21b3f0f6c608d38144eb7ae09c43ae (diff)
downloadgnuradio-4e8ef6dcae31586376986145f95689b70bc748e5.tar.gz
gnuradio-4e8ef6dcae31586376986145f95689b70bc748e5.tar.bz2
gnuradio-4e8ef6dcae31586376986145f95689b70bc748e5.zip
support multiple blocks per wrapper, makefile for data dirs
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9571 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc')
-rw-r--r--grc/data/platforms/base/Makefile.am6
-rw-r--r--grc/data/platforms/python/Makefile.am6
-rw-r--r--grc/data/platforms/python/blocks/Makefile.am6
-rw-r--r--grc/src/platforms/base/Platform.py28
4 files changed, 20 insertions, 26 deletions
diff --git a/grc/data/platforms/base/Makefile.am b/grc/data/platforms/base/Makefile.am
index f3bd0aba0..24f6f16d1 100644
--- a/grc/data/platforms/base/Makefile.am
+++ b/grc/data/platforms/base/Makefile.am
@@ -23,13 +23,11 @@ include $(top_srcdir)/grc/Makefile.inc
ourdatadir = $(grc_base_data_dir)
-DATA_FILES = \
+ourdata_DATA = \
block_tree.dtd \
flow_graph.dtd \
grc-icon-256.png \
grc-icon-256.svg \
grc-icon-32.png
-ourdata_DATA = $(DATA_FILES)
-
-EXTRA_DIST = $(DATA_FILES)
+EXTRA_DIST = $(ourdata_DATA)
diff --git a/grc/data/platforms/python/Makefile.am b/grc/data/platforms/python/Makefile.am
index a23e04018..37ac87aa3 100644
--- a/grc/data/platforms/python/Makefile.am
+++ b/grc/data/platforms/python/Makefile.am
@@ -25,13 +25,11 @@ SUBDIRS = blocks
ourdatadir = $(grc_python_data_dir)
-DATA_FILES = \
+ourdata_DATA = \
block.dtd \
block_tree.xml \
default_flow_graph.grc.xml \
flow_graph.tmpl
-ourdata_DATA = $(DATA_FILES)
-
-EXTRA_DIST = $(DATA_FILES)
+EXTRA_DIST = $(ourdata_DATA)
diff --git a/grc/data/platforms/python/blocks/Makefile.am b/grc/data/platforms/python/blocks/Makefile.am
index 766156477..b8e48d7a8 100644
--- a/grc/data/platforms/python/blocks/Makefile.am
+++ b/grc/data/platforms/python/blocks/Makefile.am
@@ -23,7 +23,7 @@ include $(top_srcdir)/grc/Makefile.inc
ourdatadir = $(grc_python_blocks_dir)
-DATA_FILES = \
+ourdata_DATA = \
audio_sink.xml \
audio_source.xml \
band_pass_filter.xml \
@@ -205,6 +205,4 @@ DATA_FILES = \
xmlrpc_client.xml \
xmlrpc_server.xml
-ourdata_DATA = $(DATA_FILES)
-
-EXTRA_DIST = $(DATA_FILES)
+EXTRA_DIST = $(ourdata_DATA)
diff --git a/grc/src/platforms/base/Platform.py b/grc/src/platforms/base/Platform.py
index c25b4a050..2904208cc 100644
--- a/grc/src/platforms/base/Platform.py
+++ b/grc/src/platforms/base/Platform.py
@@ -56,32 +56,32 @@ class Platform(_Element):
self._blocks = dict()
self._blocks_n = dict()
for block_path in self._block_paths:
- if os.path.isfile(block_path): self._load_block(block_path)
+ if os.path.isfile(block_path): self._load_blocks(block_path)
elif os.path.isdir(block_path):
for dirpath, dirnames, filenames in os.walk(block_path):
for filename in filter(lambda f: f.endswith('.xml'), filenames):
- self._load_block(os.path.join(dirpath, filename))
+ self._load_blocks(os.path.join(dirpath, filename))
def get_prefs_block(self): return self.get_new_flow_graph().get_new_block('preferences')
- def _load_block(self, f):
+ def _load_blocks(self, f):
"""
- Load the block wrapper from the file path.
- The block wrapper must pass validation, and have a unique block key.
+ Load the block wrappers from the file path.
+ The block wrapper must pass validation.
If any of the checks fail, exit with error.
@param f the file path
"""
try: ParseXML.validate_dtd(f, self._block_dtd)
except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block definition "%s" failed: \n\t%s'%(f, e))
- n = ParseXML.from_file(f)['block']
- block = self.Block(self._flow_graph, n)
- key = block.get_key()
- #test against repeated keys
- try: assert(key not in self.get_block_keys())
- except AssertionError: self._exit_with_error('Key "%s" already exists in blocks'%key)
- #store the block
- self._blocks[key] = block
- self._blocks_n[key] = n
+ for n in utils.listify(ParseXML.from_file(f), 'block'):
+ block = self.Block(self._flow_graph, n)
+ key = block.get_key()
+ #test against repeated keys
+ try: assert(key not in self.get_block_keys())
+ except AssertionError: self._exit_with_error('Key "%s" already exists in blocks'%key)
+ #store the block
+ self._blocks[key] = block
+ self._blocks_n[key] = n
def load_block_tree(self, block_tree):
"""