summaryrefslogtreecommitdiff
path: root/gr-utils/modtool/cli/add.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils/modtool/cli/add.py')
-rw-r--r--gr-utils/modtool/cli/add.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/gr-utils/modtool/cli/add.py b/gr-utils/modtool/cli/add.py
index 8078f61a0a..4a5a4f374c 100644
--- a/gr-utils/modtool/cli/add.py
+++ b/gr-utils/modtool/cli/add.py
@@ -43,14 +43,15 @@ def cli(**kwargs):
"""Adds a block to the out-of-tree module."""
kwargs['cli'] = True
self = ModToolAdd(**kwargs)
- click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green')
+ click.secho("GNU Radio module name identified: " +
+ self.info['modname'], fg='green')
get_blockname(self)
get_blocktype(self)
get_lang(self)
info_lang = {'cpp': 'C++', 'python': 'Python'}[self.info['lang']]
click.secho(f"Language: {info_lang}", fg='green')
- if ((self.skip_subdirs['lib'] and self.info['lang'] == 'cpp')
- or (self.skip_subdirs['python'] and self.info['lang'] == 'python')):
+ if ((self.skip_subdirs['lib'] and self.info['lang'] == 'cpp') or
+ (self.skip_subdirs['python'] and self.info['lang'] == 'python')):
raise ModToolException('Missing or skipping relevant subdir.')
click.secho("Block/code identifier: " + self.info['blockname'], fg='green')
if not self.license_file:
@@ -60,12 +61,13 @@ def cli(**kwargs):
get_py_qa(self)
get_cpp_qa(self)
if self.info['version'] == 'autofoo' and not self.skip_cmakefiles:
- click.secho("Warning: Autotools modules are not supported. "+
+ click.secho("Warning: Autotools modules are not supported. " +
"Files will be created, but Makefiles will not be edited.",
fg='yellow')
self.skip_cmakefiles = True
run(self)
+
def get_blocktype(self):
""" Get the blocktype of the block to be added """
if self.info['blocktype'] is None:
@@ -74,7 +76,9 @@ def get_blocktype(self):
while self.info['blocktype'] not in self.block_types:
self.info['blocktype'] = cli_input("Enter block type: ")
if self.info['blocktype'] not in self.block_types:
- click.secho('Must be one of ' + str(self.block_types), fg='yellow')
+ click.secho('Must be one of ' +
+ str(self.block_types), fg='yellow')
+
def get_lang(self):
""" Get the Programming Language of the block to be added """
@@ -85,20 +89,24 @@ def get_lang(self):
if self.info['lang'] == 'c++':
self.info['lang'] = 'cpp'
+
def get_blockname(self):
""" Get the blockname"""
if not self.info['blockname'] or self.info['blockname'].isspace():
while not self.info['blockname'] or self.info['blockname'].isspace():
- self.info['blockname'] = cli_input("Enter name of block/code (without module name prefix): ")
+ self.info['blockname'] = cli_input(
+ "Enter name of block/code (without module name prefix): ")
validate_name('block', self.info['blockname'])
- self.info['fullblockname'] = self.info['modname'] + '_' + self.info['blockname']
+ self.info['fullblockname'] = self.info['modname'] + \
+ '_' + self.info['blockname']
fname_grc = self.info['fullblockname'] + '.block.yml'
for block in os.scandir('./grc/'):
if block.is_file():
s = block.name
if s == fname_grc:
raise ModToolException('Block Already Present.')
-
+
+
def get_copyrightholder(self):
""" Get the copyrightholder of the block to be added """
if not self.info['copyrightholder'] or self.info['copyrightholder'].isspace():
@@ -109,31 +117,36 @@ def get_copyrightholder(self):
else:
copyright_candidates = (user, 'GNU Radio')
with SequenceCompleter(copyright_candidates):
- self.info['copyrightholder'] = cli_input("Please specify the copyright holder: ")
+ self.info['copyrightholder'] = cli_input(
+ "Please specify the copyright holder: ")
if not self.info['copyrightholder'] or self.info['copyrightholder'].isspace():
self.info['copyrightholder'] = f'gr-{self.info["modname"]} author'
elif self.info['is_component']:
click.secho("For GNU Radio components the FSF is added as copyright holder",
fg='cyan')
+
def get_arglist(self):
""" Get the argument list of the block to be added """
if self.info['arglist'] is None:
self.info['arglist'] = click.prompt(click.style(
'Enter valid argument list, including default arguments: \n',
fg='cyan'),
- prompt_suffix='',
- default='',
- show_default=False)
+ prompt_suffix='',
+ default='',
+ show_default=False)
+
def get_py_qa(self):
""" Get a boolean value for addition of py_qa """
if self.add_py_qa is None:
if not (self.info['blocktype'] in ('noblock') or self.skip_subdirs['python']):
- self.add_py_qa = ask_yes_no(click.style('Add Python QA code?', fg='cyan'), True)
+ self.add_py_qa = ask_yes_no(click.style(
+ 'Add Python QA code?', fg='cyan'), True)
else:
self.add_py_qa = False
+
def get_cpp_qa(self):
""" Get a boolean value for addition of cpp_qa """
if self.add_cc_qa is None: