From 055287896c8c97eb0cdda825559e217d8db54a14 Mon Sep 17 00:00:00 2001
From: Swapnil Negi <swapnil.negi09@gmail.com>
Date: Fri, 4 Jan 2019 18:29:50 +0100
Subject: modtool: gr-modtool overhaul GSoC 2018

This commit contains all the changes done during the 2018 GSoC
"gr-modtool overhaul".
Changes include:
 - Rewrite of gr-modtool based on Python Click
 - Split of gr-modtool in cli and core
 - Adherence to new GNU Radio 3.8 API for OOTs
 - Pylint improvements
 - Py3k and Py2k compatibility

 This feature is merged in a squash-merge due to big refactoring
 on the head and base branch and the impossibility to unclutter both.
---
 gr-utils/python/modtool/modtool_newmod.py | 104 ------------------------------
 1 file changed, 104 deletions(-)
 delete mode 100644 gr-utils/python/modtool/modtool_newmod.py

(limited to 'gr-utils/python/modtool/modtool_newmod.py')

diff --git a/gr-utils/python/modtool/modtool_newmod.py b/gr-utils/python/modtool/modtool_newmod.py
deleted file mode 100644
index c283204ee2..0000000000
--- a/gr-utils/python/modtool/modtool_newmod.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# Copyright 2013 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-""" 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
-
-class ModToolNewModule(ModTool):
-    """ Create a new out-of-tree module """
-    name = 'newmod'
-    description = 'Create new empty module, use add to add blocks.'
-    def __init__(self):
-        ModTool.__init__(self)
-
-    @staticmethod
-    def setup_parser(parser):
-        " Initialise the option parser for 'gr_modtool newmod' "
-        parser.add_argument("--srcdir",
-                help="Source directory for the module template.")
-        parser.add_argument("module_name", metavar='MODULE-NAME', nargs='?',
-                help="Override the current module's name (normally is autodetected).")
-
-    def setup(self, options):
-        # Don't call ModTool.setup(), that assumes an existing module.
-        self._info['modname'] = options.module_name
-        if self._info['modname'] is None:
-            if options.module_name:
-                self._info['modname'] = options.module_name
-            else:
-                self._info['modname'] = 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
-        if self._dir == '.':
-            self._dir = './gr-%s' % self._info['modname']
-        try:
-            os.stat(self._dir)
-        except OSError:
-            pass # This is what should happen
-        else:
-            raise ModToolException('The given directory exists.')
-        if options.srcdir is None:
-            options.srcdir = '/usr/local/share/gnuradio/modtool/gr-newmod'
-        self._srcdir = gr.prefs().get_string('modtool', 'newmod_path', options.srcdir)
-        if not os.path.isdir(self._srcdir):
-            raise ModToolException('Could not find gr-newmod source dir.')
-        self.options = options
-        self._setup_scm(mode='new')
-
-    def run(self, options):
-        """
-        * Copy the example dir recursively
-        * Open all files, rename howto and HOWTO to the module name
-        * Rename files and directories that contain the word howto
-        """
-        self.setup(options)
-        print("Creating out-of-tree module in %s..." % (self._dir,))
-        try:
-            shutil.copytree(self._srcdir, self._dir)
-            os.chdir(self._dir)
-        except OSError:
-            raise ModToolException('Could not create directory %s.' % self._dir)
-        for root, dirs, files in os.walk('.'):
-            for filename in files:
-                f = os.path.join(root, filename)
-                s = open(f, 'r').read()
-                s = s.replace('howto', self._info['modname'])
-                s = s.replace('HOWTO', self._info['modname'].upper())
-                open(f, 'w').write(s)
-                if filename.find('howto') != -1:
-                    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.")
-        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.")
-
-- 
cgit v1.2.3