Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mail.openembedded.org (Postfix) with ESMTP id 7251162132 for ; Wed, 25 Oct 2017 11:39:40 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 25 Oct 2017 04:39:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,431,1503385200"; d="scan'208,217";a="913566165" Received: from marquiz2.fi.intel.com ([10.237.72.79]) by FMSMGA003.fm.intel.com with ESMTP; 25 Oct 2017 04:39:40 -0700 From: Markus Lehtonen To: openembedded-core@lists.openembedded.org Date: Wed, 25 Oct 2017 14:39:38 +0300 Message-Id: <20171025113938.25060-1-markus.lehtonen@linux.intel.com> X-Mailer: git-send-email 2.13.6 Subject: [PATCH] oe-build-perf-report-email.py: add images as MIME objects X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 11:39:41 -0000 Add images as separate MIME objects instead of directly embedding images in the html (as base64 encoded pngs). This makes the emails better suited for certain email servers/clients. Signed-off-by: Markus Lehtonen --- scripts/contrib/oe-build-perf-report-email.py | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/contrib/oe-build-perf-report-email.py b/scripts/contrib/oe-build-perf-report-email.py index 64e85c26ad..913847bbed 100755 --- a/scripts/contrib/oe-build-perf-report-email.py +++ b/scripts/contrib/oe-build-perf-report-email.py @@ -25,6 +25,7 @@ import socket import subprocess import sys import tempfile +from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText @@ -111,15 +112,6 @@ def decode_png(infile, outfile): subprocess.check_output(['optipng', outfile], stderr=subprocess.STDOUT) -def encode_png(pngfile): - """Encode png into a html element""" - with open(pngfile, 'rb') as f: - data = f.read() - - b64_data = base64.b64encode(data) - return '\n' - - def mangle_html_report(infile, outfile, pngs): """Mangle html file into a email compatible format""" paste = True @@ -144,9 +136,7 @@ def mangle_html_report(infile, outfile, pngs): # Replace charts with elements match = re.match('
\n'.format(match.group('id') + '.png')) - png_file = os.path.join(png_dir, match.group('id') + '.png') - f_out.write(encode_png(png_file)) + f_out.write('