From f0f87acd2031714c3c85a6daa2407303f64486b1 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 3 Nov 2022 16:22:26 +0000 Subject: [PATCH] Bug 1798930 - Support .tgz extension in fetch-content r=taskgraph-reviewers,jmaher Many project use .tgz as a shortcut to .tar.gz. Support that pattern. Differential Revision: https://phabricator.services.mozilla.com/D161147 --- taskcluster/scripts/misc/fetch-content | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskcluster/scripts/misc/fetch-content b/taskcluster/scripts/misc/fetch-content index d18e0d082822..67697f61ffa6 100755 --- a/taskcluster/scripts/misc/fetch-content +++ b/taskcluster/scripts/misc/fetch-content @@ -312,7 +312,7 @@ def open_tar_stream(path: pathlib.Path): """""" if path.suffix == ".bz2": return bz2.open(str(path), "rb") - elif path.suffix == ".gz": + elif path.suffix in (".gz", ".tgz") : return gzip.open(str(path), "rb") elif path.suffix == ".xz": return lzma.open(str(path), "rb") @@ -327,7 +327,7 @@ def open_tar_stream(path: pathlib.Path): def archive_type(path: pathlib.Path): """Attempt to identify a path as an extractable archive.""" - if path.suffixes[-2:-1] == [".tar"]: + if path.suffixes[-2:-1] == [".tar"] or path.suffixes[-1:] == [".tgz"]: return "tar" elif path.suffix == ".zip": return "zip"