summaryrefslogtreecommitdiff
path: root/gr-utils/python/modtool/modtool_add.py
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-10-22 23:12:53 +0200
committerMartin Braun <martin.braun@ettus.com>2015-12-28 13:15:38 -0800
commit2dbbe486a51b8decc21566ceb0a5cb1c414eb499 (patch)
treefeeedf7ec01549c4cac7b635d4fbb88703741501 /gr-utils/python/modtool/modtool_add.py
parent9bfa5e35d27da1f2ee3935542e98f73c183bcb0d (diff)
modtool: Switched over to mako template engine
Diffstat (limited to 'gr-utils/python/modtool/modtool_add.py')
-rw-r--r--gr-utils/python/modtool/modtool_add.py32
1 files changed, 5 insertions, 27 deletions
diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py
index a4812c8105..75d4d6d2e4 100644
--- a/gr-utils/python/modtool/modtool_add.py
+++ b/gr-utils/python/modtool/modtool_add.py
@@ -1,5 +1,5 @@
#
-# Copyright 2013 Free Software Foundation, Inc.
+# Copyright 2013-2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -28,9 +28,7 @@ from util_functions import append_re_line_sequence, ask_yes_no
from cmakefile_editor import CMakeFileEditor
from modtool_base import ModTool, ModToolException
from templates import Templates
-from code_generator import get_template
-import Cheetah.Template
-
+from code_generator import render_template
class ModToolAdd(ModTool):
""" Add block to the out-of-tree module. """
@@ -146,7 +144,7 @@ class ModToolAdd(ModTool):
""" Shorthand for writing a substituted template to a file"""
path_to_file = os.path.join(path, fname)
print "Adding file '%s'..." % path_to_file
- open(path_to_file, 'w').write(get_template(tpl, **self._info))
+ open(path_to_file, 'w').write(render_template(tpl, **self._info))
self.scm.add_files((path_to_file,))
def run(self):
@@ -199,26 +197,6 @@ class ModToolAdd(ModTool):
self.scm.mark_files_updated((self._file['qalib'],))
except IOError:
print "Can't add C++ QA files."
- def _add_qa36():
- " Add C++ QA files for pre-3.7 API (not autotools) "
- fname_qa_cc = 'qa_%s.cc' % self._info['fullblockname']
- self._write_tpl('qa_cpp36', 'lib', fname_qa_cc)
- if not self._skip_cmakefiles:
- open(self._file['cmlib'], 'a').write(
- str(
- Cheetah.Template.Template(
- Templates['qa_cmakeentry36'],
- searchList={'basename': os.path.splitext(fname_qa_cc)[0],
- 'upperbasename': os.path.splitext(fname_qa_cc)[0].upper(),
- 'filename': fname_qa_cc,
- 'modname': self._info['modname']
- }
- )
- )
- )
- ed = CMakeFileEditor(self._file['cmlib'])
- ed.remove_double_newlines()
- ed.write()
fname_cc = None
fname_h = None
if self._info['version'] == '37':
@@ -239,7 +217,7 @@ class ModToolAdd(ModTool):
if self._info['version'] == '37':
_add_qa()
elif self._info['version'] == '36':
- _add_qa36()
+ print "Warning: C++ QA files not supported for 3.6-style OOTs."
elif self._info['version'] == 'autofoo':
print "Warning: C++ QA files not supported for autotools."
if not self._skip_cmakefiles:
@@ -264,7 +242,7 @@ class ModToolAdd(ModTool):
mod_block_sep = '/'
if self._info['version'] == '36':
mod_block_sep = '_'
- swig_block_magic_str = get_template('swig_block_magic', **self._info)
+ swig_block_magic_str = render_template('swig_block_magic', **self._info)
open(self._file['swig'], 'a').write(swig_block_magic_str)
include_str = '#include "%s%s%s.h"' % (
{True: 'gnuradio/' + self._info['modname'], False: self._info['modname']}[self._info['is_component']],