diff options
author | Douglas Anderson <danderson@ntia.doc.gov> | 2017-02-12 15:52:19 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2017-02-26 18:21:22 -0800 |
commit | 9e625c4821f4c63421b3d3747c0c4f358fef6c5f (patch) | |
tree | 41dedbe053417be7314cdce15d64fbbb89db4d8d /gr-utils/python/modtool/modtool_newmod.py | |
parent | e5aabcc6a4a9335f3ef8abf5f89104b626e9364d (diff) |
python3: update non-GRC components to use python2 or python3
Diffstat (limited to 'gr-utils/python/modtool/modtool_newmod.py')
-rw-r--r-- | gr-utils/python/modtool/modtool_newmod.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gr-utils/python/modtool/modtool_newmod.py b/gr-utils/python/modtool/modtool_newmod.py index 4382d9be7d..b3e384d122 100644 --- a/gr-utils/python/modtool/modtool_newmod.py +++ b/gr-utils/python/modtool/modtool_newmod.py @@ -20,12 +20,16 @@ # """ Create a whole new out-of-tree module """ +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals + import shutil import os import re from gnuradio import gr -from modtool_base import ModTool, ModToolException -from scm import SCMRepoFactory +from .modtool_base import ModTool, ModToolException +from .scm import SCMRepoFactory class ModToolNewModule(ModTool): """ Create a new out-of-tree module """ @@ -49,7 +53,7 @@ class ModToolNewModule(ModTool): if options.module_name: self._info['modname'] = options.module_name else: - self._info['modname'] = raw_input('Name of the new module: ') + self._info['modname'] = eval(input('Name of the new module: ')) if not re.match('[a-zA-Z0-9_]+$', self._info['modname']): raise ModToolException('Invalid module name.') self._dir = options.directory @@ -76,7 +80,7 @@ class ModToolNewModule(ModTool): * Rename files and directories that contain the word howto """ self.setup(options) - print "Creating out-of-tree module in %s..." % self._dir, + print("Creating out-of-tree module in %s..." % (self._dir,)) try: shutil.copytree(self._srcdir, self._dir) os.chdir(self._dir) @@ -93,8 +97,8 @@ class ModToolNewModule(ModTool): os.rename(f, os.path.join(root, filename.replace('howto', self._info['modname']))) if os.path.basename(root) == 'howto': os.rename(root, os.path.join(os.path.dirname(root), self._info['modname'])) - print "Done." + print("Done.") if self.scm.init_repo(path_to_repo="."): - print "Created repository... you might want to commit before continuing." - print "Use 'gr_modtool add' to add a new block to this currently empty module." + print("Created repository... you might want to commit before continuing.") + print("Use 'gr_modtool add' to add a new block to this currently empty module.") |