From 019f8807f1afb8d3dd6d0e2bbecff7624c74530f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 14 Nov 2020 11:35:04 +0100 Subject: [PATCH] =?UTF-8?q?Layout=202020=20regression=20report:=20add=20su?= =?UTF-8?q?pport=20for=20gzip=E2=80=99ed=20log=20artifacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taskcluster workers started compressing artifacts by default in https://github.com/taskcluster/taskcluster/pull/2809 --- tests/wpt/reftests-report/gen.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/wpt/reftests-report/gen.py b/tests/wpt/reftests-report/gen.py index 9156e42c469..ba07ca26469 100755 --- a/tests/wpt/reftests-report/gen.py +++ b/tests/wpt/reftests-report/gen.py @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. +import gzip import json import os import re @@ -20,7 +21,13 @@ def fetch(url): print("Fetching " + url) response = urllib.request.urlopen(url) assert response.getcode() == 200 - return response + encoding = response.info().get("Content-Encoding") + if not encoding: + return response + elif encoding == "gzip": + return gzip.GzipFile(fileobj=response) + else: + raise ValueError("Unsupported Content-Encoding: %s" % encoding) def fetch_json(url):