summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-09-06 11:24:44 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-08 00:36:49 +0100
commitce4ea7a730a7bec257218533b7c1fcb31134e25b (patch)
tree069dd26aba5ecaabbde2f5f716e9e521bbba696e /scripts/lib/recipetool/create.py
parentff259b095d1a84d1dc9b004c669c8f35659c3c2b (diff)
downloadpoky-ce4ea7a730a7bec257218533b7c1fcb31134e25b.tar.gz
recipetool: create: avoid extra blank lines in output recipe
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. (From OE-Core rev: cbebc9a2edf7d7a422ee5c71219e79e3b349de3b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 6ed4ad0ff7..cd86747821 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -714,7 +714,13 @@ def create_recipe(args):
714 sys.stdout.write('\n'.join(outlines) + '\n') 714 sys.stdout.write('\n'.join(outlines) + '\n')
715 else: 715 else:
716 with open(outfile, 'w') as f: 716 with open(outfile, 'w') as f:
717 f.write('\n'.join(outlines) + '\n') 717 lastline = None
718 for line in outlines:
719 if not lastline and not line:
720 # Skip extra blank lines
721 continue
722 f.write('%s\n' % line)
723 lastline = line
718 logger.info('Recipe %s has been created; further editing may be required to make it fully functional' % outfile) 724 logger.info('Recipe %s has been created; further editing may be required to make it fully functional' % outfile)
719 725
720 if tempsrc: 726 if tempsrc: