diff options
Diffstat (limited to 'gr-utils/python/modtool/modtool_rm.py')
-rw-r--r-- | gr-utils/python/modtool/modtool_rm.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gr-utils/python/modtool/modtool_rm.py b/gr-utils/python/modtool/modtool_rm.py index 767cb6b083..b503fa2bf3 100644 --- a/gr-utils/python/modtool/modtool_rm.py +++ b/gr-utils/python/modtool/modtool_rm.py @@ -20,14 +20,18 @@ # """ Remove blocks module """ +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals + import os import re import sys import glob -from util_functions import remove_pattern_from_file, SequenceCompleter -from modtool_base import ModTool -from cmakefile_editor import CMakeFileEditor +from .util_functions import remove_pattern_from_file, SequenceCompleter +from .modtool_base import ModTool +from .cmakefile_editor import CMakeFileEditor class ModToolRemove(ModTool): @@ -49,7 +53,7 @@ class ModToolRemove(ModTool): self._info['pattern'] = options.blockname else: with SequenceCompleter(): - self._info['pattern'] = raw_input('Which blocks do you want to delete? (Regex): ') + self._info['pattern'] = input('Which blocks do you want to delete? (Regex): ') if len(self._info['pattern']) == 0: self._info['pattern'] = '.' @@ -133,12 +137,12 @@ class ModToolRemove(ModTool): for g in globs: files = files + sorted(glob.glob("%s/%s"% (path, g))) files_filt = [] - print "Searching for matching files in %s/:" % path + print("Searching for matching files in %s/:" % path) for f in files: if re.search(self._info['pattern'], os.path.basename(f)) is not None: files_filt.append(f) if len(files_filt) == 0: - print "None found." + print("None found.") return [] # 2. Delete files, Makefile entries and other occurrences files_deleted = [] @@ -147,7 +151,7 @@ class ModToolRemove(ModTool): for f in files_filt: b = os.path.basename(f) if not yes: - ans = raw_input("Really delete %s? [Y/n/a/q]: " % f).lower().strip() + ans = input("Really delete %s? [Y/n/a/q]: " % f).lower().strip() if ans == 'a': yes = True if ans == 'q': @@ -155,10 +159,10 @@ class ModToolRemove(ModTool): if ans == 'n': continue files_deleted.append(b) - print "Deleting %s." % f + print("Deleting %s." % f) self.scm.remove_file(f) os.unlink(f) - print "Deleting occurrences of %s from %s/CMakeLists.txt..." % (b, path) + print("Deleting occurrences of %s from %s/CMakeLists.txt..." % (b, path)) for var in makefile_vars: ed.remove_value(var, b) if cmakeedit_func is not None: |