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 eef743dd61..0cb012fe9e 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 -from modtool_base import ModTool -from cmakefile_editor import CMakeFileEditor +from .util_functions import remove_pattern_from_file +from .modtool_base import ModTool +from .cmakefile_editor import CMakeFileEditor class ModToolRemove(ModTool): @@ -48,7 +52,7 @@ class ModToolRemove(ModTool): if options.blockname is not None: self._info['pattern'] = options.blockname else: - self._info['pattern'] = raw_input('Which blocks do you want to delete? (Regex): ') + self._info['pattern'] = eval(input('Which blocks do you want to delete? (Regex): ')) if len(self._info['pattern']) == 0: self._info['pattern'] = '.' @@ -132,12 +136,12 @@ class ModToolRemove(ModTool): for g in globs: files = files + 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 = [] @@ -146,7 +150,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': @@ -154,10 +158,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: |