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/grc_xml_generator.py | 105 ---------------------------
 1 file changed, 105 deletions(-)
 delete mode 100644 gr-utils/python/modtool/grc_xml_generator.py

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

diff --git a/gr-utils/python/modtool/grc_xml_generator.py b/gr-utils/python/modtool/grc_xml_generator.py
deleted file mode 100644
index 1109701f7e..0000000000
--- a/gr-utils/python/modtool/grc_xml_generator.py
+++ /dev/null
@@ -1,105 +0,0 @@
-from __future__ import absolute_import
-#
-# 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.
-#
-import xml.etree.ElementTree as ET
-from .util_functions import is_number, xml_indent
-
-try:
-    import lxml.etree
-    LXML_IMPORTED = True
-except ImportError:
-    LXML_IMPORTED = False
-
-class GRCXMLGenerator(object):
-    """ Create and write the XML bindings for a GRC block. """
-    def __init__(self, modname=None, blockname=None, doc=None, params=None, iosig=None):
-        """docstring for __init__"""
-        params_list = ['$'+s['key'] for s in params if s['in_constructor']]
-        # Can't make a dict 'cause order matters
-        self._header = (('name', blockname.replace('_', ' ').capitalize()),
-                        ('key', '%s_%s' % (modname, blockname)),
-                        ('category', '[%s]' % modname.upper()),
-                        ('import', 'import %s' % modname),
-                        ('make', '%s.%s(%s)' % (modname, blockname, ', '.join(params_list)))
-                       )
-        self.params = params
-        self.iosig = iosig
-        self.doc = doc
-        self.root = None
-        if LXML_IMPORTED:
-            self._prettyprint = self._lxml_prettyprint
-        else:
-            self._prettyprint = self._manual_prettyprint
-
-    def _lxml_prettyprint(self):
-        """ XML pretty printer using lxml """
-        return lxml.etree.tostring(
-                   lxml.etree.fromstring(ET.tostring(self.root, encoding="UTF-8")),
-                   pretty_print=True
-               )
-
-    def _manual_prettyprint(self):
-        """ XML pretty printer using xml_indent """
-        xml_indent(self.root)
-        return ET.tostring(self.root, encoding="UTF-8")
-
-    def make_xml(self):
-        """ Create the actual tag tree """
-        root = ET.Element("block")
-        iosig = self.iosig
-        for tag, value in self._header:
-            this_tag = ET.SubElement(root, tag)
-            this_tag.text = value
-        for param in self.params:
-            param_tag = ET.SubElement(root, 'param')
-            ET.SubElement(param_tag, 'name').text = param['key'].capitalize()
-            ET.SubElement(param_tag, 'key').text = param['key']
-            if len(param['default']):
-                ET.SubElement(param_tag, 'value').text = param['default']
-            ET.SubElement(param_tag, 'type').text = param['type']
-        for inout in sorted(iosig.keys()):
-            if iosig[inout]['max_ports'] == '0':
-                continue
-            for i in range(len(iosig[inout]['type'])):
-                s_tag = ET.SubElement(root, {'in': 'sink', 'out': 'source'}[inout])
-                ET.SubElement(s_tag, 'name').text = inout
-                ET.SubElement(s_tag, 'type').text = iosig[inout]['type'][i]
-                if iosig[inout]['vlen'][i] != '1':
-                    vlen = iosig[inout]['vlen'][i]
-                    if is_number(vlen):
-                        ET.SubElement(s_tag, 'vlen').text = vlen
-                    else:
-                        ET.SubElement(s_tag, 'vlen').text = '$'+vlen
-                if i == len(iosig[inout]['type'])-1:
-                    if not is_number(iosig[inout]['max_ports']):
-                        ET.SubElement(s_tag, 'nports').text = iosig[inout]['max_ports']
-                    elif len(iosig[inout]['type']) < int(iosig[inout]['max_ports']):
-                        ET.SubElement(s_tag, 'nports').text = str(int(iosig[inout]['max_ports']) -
-                                                                  len(iosig[inout]['type'])+1)
-        if self.doc is not None:
-            ET.SubElement(root, 'doc').text = self.doc
-        self.root = root
-
-    def save(self, filename):
-        """ Write the XML file """
-        self.make_xml()
-        open(filename, 'w').write(self._prettyprint())
-
-- 
cgit v1.2.3