From 6b61126c386a0a7334cdf475d349b830c436ed82 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 25 Oct 2017 14:39:38 +0300 Subject: oe-build-perf-report-email.py: add images as MIME objects 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 Signed-off-by: Ross Burton --- scripts/contrib/oe-build-perf-report-email.py | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'scripts') 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('