diff options
author | Andrej Rode <mail@andrejro.de> | 2018-09-01 03:11:29 +0200 |
---|---|---|
committer | Andrej Rode <mail@andrejro.de> | 2018-09-01 03:11:29 +0200 |
commit | 22ad9622a08132ced7ba17b8c739b49566350aec (patch) | |
tree | 0b6bab16f6f845395825649155e1e4b75a889a64 /gr-utils/python/modtool/modtool_add.py | |
parent | 860041a7ad0c28e4865dad82235c2985b17bc359 (diff) |
modtool: Py3k compat in modtool_add
Diffstat (limited to 'gr-utils/python/modtool/modtool_add.py')
-rw-r--r-- | gr-utils/python/modtool/modtool_add.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py index 46ff74168a..2ff5a9ad30 100644 --- a/gr-utils/python/modtool/modtool_add.py +++ b/gr-utils/python/modtool/modtool_add.py @@ -24,8 +24,11 @@ from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals +from builtins import input + import os import re +import getpass from .util_functions import append_re_line_sequence, ask_yes_no, SequenceCompleter from .cmakefile_editor import CMakeFileEditor @@ -72,15 +75,15 @@ class ModToolAdd(ModTool): ModTool.setup(self, options) if self._info['blockname'] is None: - if len(args) >= 2: - self._info['blockname'] = args[1] + if len(options) >= 2: + self._info['blockname'] = options[1] else: - self._info['blockname'] = raw_input("Enter name of block/code (without module name prefix): ") + self._info['blockname'] = input("Enter name of block/code (without module name prefix): ") if os.path.isfile("./lib/"+self._info['blockname']+"_impl.cc") or os.path.isfile("./python/"+self._info['blockname']+".py"): raise ModToolException('The given blockname already exists!') if not re.match('[a-zA-Z0-9_]+', self._info['blockname']): raise ModToolException('Invalid block name.') - print "Block/code identifier: " + self._info['blockname'] + print("Block/code identifier: " + self._info['blockname']) self._info['fullblockname'] = self._info['modname'] + '_' + self._info['blockname'] self._info['blocktype'] = options.block_type @@ -125,7 +128,7 @@ class ModToolAdd(ModTool): else: copyright_candidates = (user, 'GNU Radio') with SequenceCompleter(copyright_candidates): - self._info['copyrightholder'] = raw_input("Please specify the copyright holder: ") + self._info['copyrightholder'] = input("Please specify the copyright holder: ") if not self._info['copyrightholder'] or self._info['copyrightholder'].isspace(): self._info['copyrightholder'] = "gr-"+self._info['modname']+" author" elif self._info['is_component']: |