summaryrefslogtreecommitdiff
path: root/gr-utils/python/modtool
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils/python/modtool')
-rw-r--r--gr-utils/python/modtool/gr-newmod/CMakeLists.txt7
-rw-r--r--gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake3
-rw-r--r--gr-utils/python/modtool/modtool_add.py14
-rw-r--r--gr-utils/python/modtool/modtool_rename.py6
-rw-r--r--gr-utils/python/modtool/templates.py2
5 files changed, 24 insertions, 8 deletions
diff --git a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
index 0513f44086..6f32f21833 100644
--- a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
@@ -24,6 +24,12 @@ cmake_minimum_required(VERSION 2.6)
project(gr-howto CXX C)
enable_testing()
+#install to PyBOMBS target prefix if defined
+if(DEFINED ENV{PYBOMBS_PREFIX})
+ set(CMAKE_INSTALL_PREFIX $ENV{PYBOMBS_PREFIX})
+ message(STATUS "PyBOMBS installed GNU Radio. Setting CMAKE_INSTALL_PREFIX to $ENV{PYBOMBS_PREFIX}")
+endif()
+
#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
@@ -112,6 +118,7 @@ find_package(Doxygen)
# API compatible version required.
set(GR_REQUIRED_COMPONENTS RUNTIME)
find_package(Gnuradio "3.7.2" REQUIRED)
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
if(NOT CPPUNIT_FOUND)
message(FATAL_ERROR "CppUnit required to compile howto")
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
index 188c40480b..5bad57c51e 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
@@ -363,6 +363,7 @@ macro(GR_EXPAND_X_H component root)
import sys, os, re
sys.path.append('${GR_RUNTIME_PYTHONPATH}')
+sys.path.append('${CMAKE_SOURCE_DIR}/python')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
@@ -406,6 +407,7 @@ macro(GR_EXPAND_X_CC_H component root)
import sys, os, re
sys.path.append('${GR_RUNTIME_PYTHONPATH}')
+sys.path.append('${CMAKE_SOURCE_DIR}/python')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
@@ -466,6 +468,7 @@ macro(GR_EXPAND_X_CC_H_IMPL component root)
import sys, os, re
sys.path.append('${GR_RUNTIME_PYTHONPATH}')
+sys.path.append('${CMAKE_SOURCE_DIR}/python')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py
index a4812c8105..3627dc6ad1 100644
--- a/gr-utils/python/modtool/modtool_add.py
+++ b/gr-utils/python/modtool/modtool_add.py
@@ -53,6 +53,8 @@ class ModToolAdd(ModTool):
choices=self._block_types, default=None, help="One of %s." % ', '.join(self._block_types))
ogroup.add_option("--license-file", type="string", default=None,
help="File containing the license header for every source code file.")
+ ogroup.add_option("--copyright", type="string", default=None,
+ help="Name of the copyright holder (you or your company) MUST be a quoted string.")
ogroup.add_option("--argument-list", type="string", default=None,
help="The argument list for the constructor and make functions.")
ogroup.add_option("--add-python-qa", action="store_true", default=None,
@@ -77,7 +79,6 @@ class ModToolAdd(ModTool):
self._info['blocktype'] = raw_input("Enter block type: ")
if self._info['blocktype'] not in self._block_types:
print 'Must be one of ' + str(self._block_types)
-
# Allow user to specify language interactively if not set
self._info['lang'] = options.lang
if self._info['lang'] is None:
@@ -102,8 +103,14 @@ class ModToolAdd(ModTool):
raise ModToolException('Invalid block name.')
print "Block/code identifier: " + self._info['blockname']
self._info['fullblockname'] = self._info['modname'] + '_' + self._info['blockname']
+ if not options.license_file:
+ self._info['copyrightholder'] = options.copyright
+ if self._info['copyrightholder'] is None:
+ self._info['copyrightholder'] = '<+YOU OR YOUR COMPANY+>'
+ elif self._info['is_component']:
+ print "For GNU Radio components the FSF is added as copyright holder"
+ self._license_file = options.license_file
self._info['license'] = self.setup_choose_license()
-
if options.argument_list is not None:
self._info['arglist'] = options.argument_list
else:
@@ -122,7 +129,6 @@ class ModToolAdd(ModTool):
print "Warning: Autotools modules are not supported. ",
print "Files will be created, but Makefiles will not be edited."
self._skip_cmakefiles = True
- self._license_file = options.license_file
def setup_choose_license(self):
""" Select a license by the following rules, in this order:
@@ -140,7 +146,7 @@ class ModToolAdd(ModTool):
elif self._info['is_component']:
return Templates['grlicense']
else:
- return Templates['defaultlicense']
+ return get_template('defaultlicense', **self._info)
def _write_tpl(self, tpl, path, fname):
""" Shorthand for writing a substituted template to a file"""
diff --git a/gr-utils/python/modtool/modtool_rename.py b/gr-utils/python/modtool/modtool_rename.py
index 8f1b250c00..4d3f5cb17e 100644
--- a/gr-utils/python/modtool/modtool_rename.py
+++ b/gr-utils/python/modtool/modtool_rename.py
@@ -33,9 +33,9 @@ import Cheetah.Template
class ModToolRename(ModTool):
- """ Add block to the out-of-tree module. """
+ """ Rename a block in the out-of-tree module. """
name = 'rename'
- aliases = ('insert',)
+ aliases = ('mv',)
def __init__(self):
ModTool.__init__(self)
@@ -168,7 +168,7 @@ class ModToolRename(ModTool):
grcfile = './grc/' + module + '_' + old + '.xml'
self._run_file_replace(grcfile, old, new)
self._run_cmakelists('./grc/', old, new)
- self._run_file_rename('./grc/', old, new)
+ self._run_file_rename('./grc/', module + '_' + old, module + '_' + new)
def _run_cmakelists(self, path, first, second):
filename = path + 'CMakeLists.txt'
diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py
index dc840df392..9caf658194 100644
--- a/gr-utils/python/modtool/templates.py
+++ b/gr-utils/python/modtool/templates.py
@@ -26,7 +26,7 @@ Templates = {}
# Default licence
Templates['defaultlicense'] = '''
-Copyright %d <+YOU OR YOUR COMPANY+>.
+Copyright %d ${copyrightholder}.
This is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by