]> git.gag.com Git - debian/gnuradio/commitdiff
support multiple blocks per wrapper, makefile for data dirs
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Sun, 14 Sep 2008 02:43:47 +0000 (02:43 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Sun, 14 Sep 2008 02:43:47 +0000 (02:43 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9571 221aa14e-8319-0410-a670-987f0aec2ac5

grc/data/platforms/base/Makefile.am
grc/data/platforms/python/Makefile.am
grc/data/platforms/python/blocks/Makefile.am
grc/src/platforms/base/Platform.py

index f3bd0aba052ebb9b3980e4db465c4654b1cdb504..24f6f16d11564d8f85894219cd483c1c4b7c8b3f 100644 (file)
@@ -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)
index a23e04018056ad5ee6a8657ea9f4635af055dfbc..37ac87aa3da306885b0712674a82faa86ef0ec34 100644 (file)
@@ -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)
 
index 76615647753fd7ad6892410fc5e1604bbb74d815..b8e48d7a895f5a284a7ac7aa5a6c99d37f02ccd6 100644 (file)
@@ -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)
index c25b4a0509f8feb34500972e9d3bfd194ef3b47a..2904208ccf1502104a82ca14965efdd5a15df856 100644 (file)
@@ -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):
                """