summaryrefslogtreecommitdiff
path: root/gr-utils/python
diff options
context:
space:
mode:
authorRon Economos <w6rz@comcast.net>2019-03-08 19:56:29 +0100
committerMarcus Müller <marcus@hostalia.de>2019-03-08 20:24:48 +0100
commitbe11e7a256e2a36096234dd3dae5e6ed731069c9 (patch)
tree57d9346671658a2328b3619219b41d5464931ad2 /gr-utils/python
parentbdaee5982f40f739dcb58a4963a813fb2746cf49 (diff)
utils: remove space inserted for empty comment lines from generated code
Diffstat (limited to 'gr-utils/python')
-rw-r--r--gr-utils/python/modtool/tools/util_functions.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/gr-utils/python/modtool/tools/util_functions.py b/gr-utils/python/modtool/tools/util_functions.py
index 15409eacc3..709c9aeb40 100644
--- a/gr-utils/python/modtool/tools/util_functions.py
+++ b/gr-utils/python/modtool/tools/util_functions.py
@@ -1,5 +1,5 @@
#
-# Copyright 2013, 2018 Free Software Foundation, Inc.
+# Copyright 2013, 2018, 2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -57,15 +57,32 @@ def remove_pattern_from_file(filename, pattern):
def str_to_fancyc_comment(text):
""" Return a string as a C formatted comment. """
l_lines = text.splitlines()
- outstr = "/* " + l_lines[0] + "\n"
+ if len(l_lines[0]) == 0:
+ outstr = "/*\n"
+ else:
+ outstr = "/* " + l_lines[0] + "\n"
for line in l_lines[1:]:
- outstr += " * " + line + "\n"
+ if len(line) == 0:
+ outstr += " *\n"
+ else:
+ outstr += " * " + line + "\n"
outstr += " */\n"
return outstr
def str_to_python_comment(text):
""" Return a string as a Python formatted comment. """
- return re.compile('^', re.MULTILINE).sub('# ', text)
+ l_lines = text.splitlines()
+ if len(l_lines[0]) == 0:
+ outstr = "#\n"
+ else:
+ outstr = "# " + l_lines[0] + "\n"
+ for line in l_lines[1:]:
+ if len(line) == 0:
+ outstr += "#\n"
+ else:
+ outstr += "# " + line + "\n"
+ outstr += "#\n"
+ return outstr
def strip_default_values(string):
""" Strip default values from a C++ argument list. """