]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
recipetool: create: avoid extra blank lines in output recipe
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 5 Sep 2016 23:24:44 +0000 (11:24 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 7 Sep 2016 23:36:43 +0000 (00:36 +0100)
If we output extra blank lines (because of some automated editing) then
it makes the output recipe look a bit untidy. You could argue that we
should simply have the editing code not do that, but sometimes we don't
have enough context there for that to be practical. It's simple enough
to just filter out the extra blank lines when writing the file, so just
do it that way.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
scripts/lib/recipetool/create.py

index 6ed4ad0ff728901b103b661f74da1dfe2f2cea48..cd8674782175c91b96fbe3b72b7cff943a086ce6 100644 (file)
@@ -714,7 +714,13 @@ def create_recipe(args):
         sys.stdout.write('\n'.join(outlines) + '\n')
     else:
         with open(outfile, 'w') as f:
-            f.write('\n'.join(outlines) + '\n')
+            lastline = None
+            for line in outlines:
+                if not lastline and not line:
+                    # Skip extra blank lines
+                    continue
+                f.write('%s\n' % line)
+                lastline = line
         logger.info('Recipe %s has been created; further editing may be required to make it fully functional' % outfile)
 
     if tempsrc: