[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 24/43: grc: use 'import' for grc-generated
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 24/43: grc: use 'import' for grc-generated hier_blocks (#763) |
Date: |
Thu, 2 Apr 2015 19:15:51 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit a1e7743b33eb3cc2c94775e95e5fc436a4d3f7ae
Author: Sebastian Koslowski <address@hidden>
Date: Thu Feb 12 10:41:01 2015 +0100
grc: use 'import' for grc-generated hier_blocks (#763)
---
grc/python/Generator.py | 7 ++++---
grc/python/flow_graph.tmpl | 8 +++++---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index a263679..191ec18 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(
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index a0de5d1..41ab67c 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -48,13 +48,15 @@ if __name__ == '__main__':
########################################################
##Create Imports
########################################################
-#if any("GRC_HIER_PATH" in imp for imp in $imports)
+#if any(imp.endswith("# grc-generated hier_block") for imp in $imports)
import os
-GRC_HIER_PATH = os.environ.get('GRC_HIER_PATH',
os.path.expanduser('~/.grc_gnuradio'))
+import sys
+#set imports = $filter(lambda i: i not in ("import os", "import sys"),
$imports)
+sys.path.append(os.environ.get('GRC_HIER_PATH',
os.path.expanduser('~/.grc_gnuradio')))
#end if
#for $imp in $imports
-$imp
+$(imp.replace(" # grc-generated hier_block", ""))
#end for
########################################################
- [Commit-gnuradio] [gnuradio] 42/43: Merge remote-tracking branch 'michaelld/misc_fixes', (continued)
- [Commit-gnuradio] [gnuradio] 42/43: Merge remote-tracking branch 'michaelld/misc_fixes', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 29/43: grc: move context def into Bars.py and add submenu, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 14/43: gnuradio-runtime: modified buffer length types to size_t, moved buffer length vectors into detail, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 22/43: grc: close unsaved pages first (for cancel save option), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 13/43: fec: ldpc GRC compat cleanup, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 36/43: Merge remote-tracking branch 'fengzhe/chunks_to_symbols_update', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 25/43: grc: set permissions for generated files, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 08/43: fec: adding ldpc encoder and decoder, initial compile working, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 23/43: grc: make use of GRC_HIER_PATH at runtime, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 33/43: Merge remote-tracking branch 'saikwolf/hier_buff_tweak', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 24/43: grc: use 'import' for grc-generated hier_blocks (#763),
git <=
- [Commit-gnuradio] [gnuradio] 02/43: gnuradio-runtime: updated hier_block2 and hier_block_detail to allow for propagation of min/max output buffer to all blocks within the hier, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 21/43: grc: Default button in save dialog is now 'save' instead of 'close without saving', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 37/43: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 05/43: digital: bug fixed in chunks_to_symbols that the callback functiion set_symbol_table didn't work with additonal qa_tests, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 32/43: Merge branch 'maint', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 09/43: fec: adding objects needed to run LDPC along with example ALIST file, now imports and instantiates happily, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 41/43: qtgui: use QPen::setWidthF for non-integer values., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 39/43: dtv: move "static const" variables from header / class into the main code. The original code is not necessary to have in the class, and causes issues when compiling using c++11 compliance., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 43/43: Merge remote-tracking branch 'michaelld/fixes_for_std_complex', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 38/43: dtv: redo c++0x complaint std::complex to be c++11 compliant; works on OSX with GCC (4.2 and 4.8, using listdc++) and Clang (LLVM 3.4 and 3.6, using libc++), with and without -std=c++11., git, 2015/04/02