From: Paul Eggleton Date: Mon, 5 Sep 2016 23:24:44 +0000 (+1200) Subject: recipetool: create: avoid extra blank lines in output recipe X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce4ea7a730a7bec257218533b7c1fcb31134e25b;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Richard Purdie --- diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 6ed4ad0ff72..cd867478217 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -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: