diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2015-02-12 10:41:01 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2015-04-02 09:20:25 +0200 |
commit | a1e7743b33eb3cc2c94775e95e5fc436a4d3f7ae (patch) | |
tree | 73b214642429c91bf7fcf40efd29698e0972e7a8 /grc/python/Generator.py | |
parent | 15417bdd699beef1905dd94b66ac39444b96d70d (diff) |
grc: use 'import' for grc-generated hier_blocks (#763)
Diffstat (limited to 'grc/python/Generator.py')
-rw-r--r-- | grc/python/Generator.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/grc/python/Generator.py b/grc/python/Generator.py index a263679a8e..191ec18f35 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -219,8 +219,8 @@ class HierBlockGenerator(TopBlockGenerator): """ TopBlockGenerator.__init__(self, flow_graph, file_path) self._mode = HIER_BLOCK_FILE_MODE - self._file_name = self._flow_graph.get_option('id') + '.py' - self._file_path = os.path.join(HIER_BLOCKS_LIB_DIR, self._file_name) + self._file_path = os.path.join(HIER_BLOCKS_LIB_DIR, + self._flow_graph.get_option('id') + '.py') self._file_path_xml = self._file_path + '.xml' def get_file_path_xml(self): @@ -254,7 +254,8 @@ class HierBlockGenerator(TopBlockGenerator): self._flow_graph.get_option('id').replace('_', ' ').title() block_n['key'] = block_key block_n['category'] = self._flow_graph.get_option('category') - block_n['import'] = 'execfile(os.path.join(GRC_HIER_PATH, ' + repr(self._file_name) + '))' + block_n['import'] = "from {0} import {0} # grc-generated hier_block".format( + self._flow_graph.get_option('id')) # make data if parameters: block_n['make'] = '{cls}(\n {kwargs},\n)'.format( |