From fa5480e8bccec39278e9c5f81c09d1e702fd0fd7 Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski <koslowski@kit.edu> Date: Sun, 24 Nov 2013 20:23:39 +0100 Subject: modtool: no more exit() in modtool package Conflicts: gr-utils/python/modtool/modtool_newmod.py --- gr-utils/python/modtool/modtool_rm.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'gr-utils/python/modtool/modtool_rm.py') diff --git a/gr-utils/python/modtool/modtool_rm.py b/gr-utils/python/modtool/modtool_rm.py index 32dfee4806..4b69be180a 100644 --- a/gr-utils/python/modtool/modtool_rm.py +++ b/gr-utils/python/modtool/modtool_rm.py @@ -24,26 +24,27 @@ import os import re import sys import glob -from optparse import OptionGroup from util_functions import remove_pattern_from_file from modtool_base import ModTool from cmakefile_editor import CMakeFileEditor + class ModToolRemove(ModTool): """ Remove block (delete files and remove Makefile entries) """ name = 'remove' aliases = ('rm', 'del') + def __init__(self): ModTool.__init__(self) - def setup(self): - ModTool.setup(self) - options = self.options + def setup(self, options, args): + ModTool.setup(self, options, args) + if options.block_name is not None: self._info['pattern'] = options.block_name - elif len(self.args) >= 2: - self._info['pattern'] = self.args[1] + elif len(args) >= 2: + self._info['pattern'] = args[1] else: self._info['pattern'] = raw_input('Which blocks do you want to delete? (Regex): ') if len(self._info['pattern']) == 0: @@ -111,7 +112,6 @@ class ModToolRemove(ModTool): if not self._skip_subdirs['grc']: self._run_subdir('grc', ('*.xml',), ('install',)) - def _run_subdir(self, path, globs, makefile_vars, cmakeedit_func=None): """ Delete all files that match a certain pattern in path. path - The directory in which this will take place @@ -132,7 +132,7 @@ class ModToolRemove(ModTool): if len(files_filt) == 0: print "None found." return [] - # 2. Delete files, Makefile entries and other occurences + # 2. Delete files, Makefile entries and other occurrences files_deleted = [] ed = CMakeFileEditor('%s/CMakeLists.txt' % path) yes = self._info['yes'] @@ -156,4 +156,3 @@ class ModToolRemove(ModTool): cmakeedit_func(b, ed) ed.write() return files_deleted - -- cgit v1.2.3