summaryrefslogtreecommitdiff
path: root/gr-utils/python/modtool/modtool_makexml.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils/python/modtool/modtool_makexml.py')
-rw-r--r--gr-utils/python/modtool/modtool_makexml.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/gr-utils/python/modtool/modtool_makexml.py b/gr-utils/python/modtool/modtool_makexml.py
index 311ed96cb4..74fed4b7a1 100644
--- a/gr-utils/python/modtool/modtool_makexml.py
+++ b/gr-utils/python/modtool/modtool_makexml.py
@@ -20,15 +20,19 @@
#
""" Automatically create XML bindings for GRC from block code """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
import glob
-from modtool_base import ModTool, ModToolException
-from parser_cc_block import ParserCCBlock
-from grc_xml_generator import GRCXMLGenerator
-from cmakefile_editor import CMakeFileEditor
-from util_functions import ask_yes_no
+from .modtool_base import ModTool, ModToolException
+from .parser_cc_block import ParserCCBlock
+from .grc_xml_generator import GRCXMLGenerator
+from .cmakefile_editor import CMakeFileEditor
+from .util_functions import ask_yes_no
class ModToolMakeXML(ModTool):
@@ -54,13 +58,13 @@ class ModToolMakeXML(ModTool):
if options.blockname is not None:
self._info['pattern'] = options.blockname
else:
- self._info['pattern'] = raw_input('Which blocks do you want to parse? (Regex): ')
+ self._info['pattern'] = input('Which blocks do you want to parse? (Regex): ')
if len(self._info['pattern']) == 0:
self._info['pattern'] = '.'
def run(self, options):
""" Go, go, go! """
- print "Warning: This is an experimental feature. Don't expect any magic."
+ print("Warning: This is an experimental feature. Don't expect any magic.")
self.setup(options)
# 1) Go through lib/
if not self._skip_subdirs['lib']:
@@ -80,12 +84,12 @@ class ModToolMakeXML(ModTool):
""" Search for files matching pattern in the given path. """
files = sorted(glob.glob("%s/%s"% (path, path_glob)))
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 files_filt
def _make_grc_xml_from_block_data(self, params, iosig, blockname):
@@ -110,7 +114,7 @@ class ModToolMakeXML(ModTool):
return
else:
file_exists = True
- print "Warning: Overwriting existing GRC file."
+ print("Warning: Overwriting existing GRC file.")
grc_generator = GRCXMLGenerator(
modname=self._info['modname'],
blockname=blockname,
@@ -125,7 +129,7 @@ class ModToolMakeXML(ModTool):
if not self._skip_subdirs['grc']:
ed = CMakeFileEditor(self._file['cmgrc'])
if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'):
- print "Adding GRC bindings to grc/CMakeLists.txt..."
+ print("Adding GRC bindings to grc/CMakeLists.txt...")
ed.append_value('install', fname_xml, to_ignore_end='DESTINATION[^()]+')
ed.write()
self.scm.mark_files_updated(self._file['cmgrc'])
@@ -158,7 +162,7 @@ class ModToolMakeXML(ModTool):
blockname = blockname.replace(self._info['modname']+'_', '', 1)
return (blockname, fname_h)
# Go, go, go
- print "Making GRC bindings for %s..." % fname_cc
+ print("Making GRC bindings for %s..." % fname_cc)
(blockname, fname_h) = _get_blockdata(fname_cc)
try:
parser = ParserCCBlock(fname_cc,