summaryrefslogtreecommitdiff
path: root/gr-utils/python/modtool/modtool_rm.py
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-06-23 23:41:42 +0200
committerAndrej Rode <mail@andrejro.de>2018-06-24 00:03:35 +0200
commit167a6152bad060fc53dd29e0fa79ef83eff1be5b (patch)
treea01049672d9d7d1bf3d295ed96698a323941f8e8 /gr-utils/python/modtool/modtool_rm.py
parent3c8e6008b092287246234001db7cf1a4038300da (diff)
parentfcd002b6ac82e1e0c1224e24506410ff0833e1aa (diff)
Merge branch 'python3_fix' into next
Manual merge conflict resolution has been applied to following conflicts: * Typos: * gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py * gr-blocks/python/blocks/qa_wavfile.py * gr-filter/examples/gr_filtdes_api.py * grc/blocks/parameter.xml * gr-uhd/python/uhd/__init__.py * ValueError -> RuntimeError: * gr-blocks/python/blocks/qa_hier_block2.py * relative Imports & other Py3k: * gr-digital/python/digital/psk_constellations.py * gr-digital/python/digital/qam_constellations.py * gr-digital/python/digital/test_soft_decisions.py * gr-digital/python/digital/gfsk.py * SequenceCompleter: * gr-utils/python/modtool/modtool_add.py * gr-utils/python/modtool/modtool_rename.py * gr-utils/python/modtool/modtool_rm.py * Updated API on next: * gr-blocks/grc/blocks_file_source.xml * gr-blocks/python/blocks/qa_file_source_sink.py * gr-qtgui/grc/qtgui_time_sink_x.xml * GRC Py3k Updates: * grc/core/Block.py * grc/core/Constants.py * grc/core/Platform.py * grc/core/utils/odict.py * grc/gui/Actions.py * grc/gui/Block.py * grc/gui/Executor.py * grc/gui/Port.py
Diffstat (limited to 'gr-utils/python/modtool/modtool_rm.py')
-rw-r--r--gr-utils/python/modtool/modtool_rm.py22
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: