[rtems-source-builder commit] sb/setbuilder: Support line continuation

Chris Johns chrisj at rtems.org
Mon Sep 19 21:24:51 UTC 2022


Module:    rtems-source-builder
Branch:    5
Commit:    e85e2a730009fd1833fd7702a5332cab015cdfcc
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=e85e2a730009fd1833fd7702a5332cab015cdfcc

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Sep  8 08:15:13 2022 +1000

sb/setbuilder: Support line continuation

Updates #4716

---

 source-builder/sb/setbuilder.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index 16e8cc8..55bd86f 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -284,6 +284,13 @@ class buildset:
                 line = line[1:b]
             return line.strip()
 
+        def _clean_and_pack(line, last_line):
+            leading_ws = ' ' if len(line) > 0 and line[0].isspace() else ''
+            line = _clean(line)
+            if len(last_line) > 0:
+                line = last_line + leading_ws + line
+            return line
+
         bset = macro_expand(self.macros, bset)
         bsetname = bset
 
@@ -306,11 +313,16 @@ class buildset:
 
         try:
             lc = 0
+            ll = ''
             for l in bset:
                 lc += 1
-                l = _clean(l)
+                l = _clean_and_pack(l, ll)
                 if len(l) == 0:
                     continue
+                if l[-1] == '\\':
+                    ll = l[0:-1]
+                    continue
+                ll = ''
                 log.trace('_bset:   : %s: %03d: %s' % (self.bset, lc, l))
                 ls = l.split()
                 if ls[0][-1] == ':' and ls[0][:-1] == 'package':



More information about the vc mailing list