[oe-commits] [openembedded-core] 09/13: recipetool: create: avoid extra blank lines in output recipe
git at git.openembedded.org
git at git.openembedded.org
Tue Sep 6 22:19:22 UTC 2016
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 69ee4d26111d3eda3c7f9bdffeb5328e9128a2e8
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Tue Sep 6 22:03:30 2016 +1200
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.
Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/lib/recipetool/create.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index f1ce28c..b6de999 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -715,7 +715,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:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list