summaryrefslogtreecommitdiff
path: root/gr-utils/src/python/modtool
diff options
context:
space:
mode:
authorMartin Braun2013-01-28 11:48:17 +0100
committerMartin Braun2013-01-28 11:48:17 +0100
commitede34060de27184eb6f6df6b5fd03ae8a643bf91 (patch)
tree90ab60435eabdcaac7ea5c28dee5cf35ebaa41cf /gr-utils/src/python/modtool
parent03f101f509818a22d9488b4e5d08b9f0cd2b3b26 (diff)
downloadgnuradio-ede34060de27184eb6f6df6b5fd03ae8a643bf91.tar.gz
gnuradio-ede34060de27184eb6f6df6b5fd03ae8a643bf91.tar.bz2
gnuradio-ede34060de27184eb6f6df6b5fd03ae8a643bf91.zip
modtool: bugfixes
Diffstat (limited to 'gr-utils/src/python/modtool')
-rw-r--r--gr-utils/src/python/modtool/modtool_add.py20
-rw-r--r--gr-utils/src/python/modtool/modtool_makexml.py2
-rw-r--r--gr-utils/src/python/modtool/modtool_rm.py2
3 files changed, 10 insertions, 14 deletions
diff --git a/gr-utils/src/python/modtool/modtool_add.py b/gr-utils/src/python/modtool/modtool_add.py
index a6c84bea8..32cfe0440 100644
--- a/gr-utils/src/python/modtool/modtool_add.py
+++ b/gr-utils/src/python/modtool/modtool_add.py
@@ -81,7 +81,7 @@ class ModToolAdd(ModTool):
if ((self._skip_subdirs['lib'] and self._info['lang'] == 'cpp')
or (self._skip_subdirs['python'] and self._info['lang'] == 'python')):
print "Missing or skipping relevant subdir."
- sys.exit(1)
+ exit(1)
if self._info['blockname'] is None:
if len(self.args) >= 2:
@@ -90,7 +90,7 @@ class ModToolAdd(ModTool):
self._info['blockname'] = raw_input("Enter name of block/code (without module name prefix): ")
if not re.match('[a-zA-Z0-9_]+', self._info['blockname']):
print 'Invalid block name.'
- sys.exit(2)
+ exit(2)
print "Block/code identifier: " + self._info['blockname']
self._info['fullblockname'] = self._info['modname'] + '_' + self._info['blockname']
self._info['license'] = self.setup_choose_license()
@@ -143,22 +143,17 @@ class ModToolAdd(ModTool):
)
has_grc = False
if self._info['lang'] == 'cpp':
- print "Traversing lib..."
self._run_lib()
has_grc = has_swig
else: # Python
- print "Traversing python..."
self._run_python()
if self._info['blocktype'] != 'noblock':
has_grc = True
if has_swig:
- print "Traversing swig..."
self._run_swig()
if self._add_py_qa:
- print "Adding Python QA..."
self._run_python_qa()
if has_grc and not self._skip_subdirs['grc']:
- print "Traversing grc..."
self._run_grc()
def _run_lib(self):
@@ -178,7 +173,7 @@ class ModToolAdd(ModTool):
try:
append_re_line_sequence(self._file['cmlib'],
'\$\{CMAKE_CURRENT_SOURCE_DIR\}/qa_%s.cc.*\n' % self._info['modname'],
- ' ${CMAKE_CURRENT_SOURCE_DIR}/qa_%s.cc' % self._info['blockname'])
+ ' ${CMAKE_CURRENT_SOURCE_DIR}/qa_%s.cc' % self._info['blockname'])
append_re_line_sequence(self._file['qalib'],
'#include.*\n',
'#include "%s"' % fname_qa_h)
@@ -226,10 +221,11 @@ class ModToolAdd(ModTool):
self._write_tpl('block_cpp36', 'lib', fname_cc)
if not self.options.skip_cmakefiles:
ed = CMakeFileEditor(self._file['cmlib'])
- ed.append_value('add_library', fname_cc)
+ if not ed.append_value('list', fname_cc, to_ignore_start='APPEND %s_sources' % self._info['modname']):
+ ed.append_value('add_library', fname_cc)
ed.write()
ed = CMakeFileEditor(self._file['cminclude'])
- ed.append_value('install', fname_h, 'DESTINATION[^()]+')
+ ed.append_value('install', fname_h, to_ignore_end='DESTINATION[^()]+')
ed.write()
if self._add_cc_qa:
if self._info['version'] == '37':
@@ -295,7 +291,7 @@ class ModToolAdd(ModTool):
if self.options.skip_cmakefiles:
return
ed = CMakeFileEditor(self._file['cmpython'])
- ed.append_value('GR_PYTHON_INSTALL', fname_py, 'DESTINATION[^()]+')
+ ed.append_value('GR_PYTHON_INSTALL', fname_py, to_ignore_end='DESTINATION[^()]+')
ed.write()
def _run_grc(self):
@@ -310,6 +306,6 @@ class ModToolAdd(ModTool):
if self.options.skip_cmakefiles or ed.check_for_glob('*.xml'):
return
print "Editing grc/CMakeLists.txt..."
- ed.append_value('install', fname_grc, 'DESTINATION[^()]+')
+ ed.append_value('install', fname_grc, to_ignore_end='DESTINATION[^()]+')
ed.write()
diff --git a/gr-utils/src/python/modtool/modtool_makexml.py b/gr-utils/src/python/modtool/modtool_makexml.py
index acf3e459c..104a0fdbd 100644
--- a/gr-utils/src/python/modtool/modtool_makexml.py
+++ b/gr-utils/src/python/modtool/modtool_makexml.py
@@ -122,7 +122,7 @@ class ModToolMakeXML(ModTool):
ed = CMakeFileEditor(self._file['cmgrc'])
if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'):
print "Adding GRC bindings to grc/CMakeLists.txt..."
- ed.append_value('install', fname_xml, 'DESTINATION[^()]+')
+ ed.append_value('install', fname_xml, to_ignore_end='DESTINATION[^()]+')
ed.write()
def _parse_cc_h(self, fname_cc):
diff --git a/gr-utils/src/python/modtool/modtool_rm.py b/gr-utils/src/python/modtool/modtool_rm.py
index bdbd802f3..02ce8ef3f 100644
--- a/gr-utils/src/python/modtool/modtool_rm.py
+++ b/gr-utils/src/python/modtool/modtool_rm.py
@@ -83,7 +83,7 @@ class ModToolRemove(ModTool):
elif ext == '.cc':
ed.remove_value('list',
'\$\{CMAKE_CURRENT_SOURCE_DIR\}/%s' % filename,
- 'APPEND test_%s_sources' % self._info['modname'])
+ to_ignore_start='APPEND test_%s_sources' % self._info['modname'])
else:
filebase = os.path.splitext(filename)[0]
ed.delete_entry('add_executable', filebase)