diff options
| author | Henrik Lindström <henrik@lxm.se> | 2025-05-11 09:56:38 +0200 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-05-11 15:58:40 -0400 |
| commit | 25854d75846ea9fea357e3b28c5242ffe48dda79 (patch) | |
| tree | e58b7688de6d3fc392259a4963e4a14e55313418 | |
| parent | 24d7c347f5650b14f991da8f8c92b8ef6e4ff110 (diff) | |
| download | meson-25854d75846ea9fea357e3b28c5242ffe48dda79.tar.gz | |
mdist.py: Import gzip only when needed
This is already done for bz2 and lzma, but even gzip is not always available
in a minimal Python installation. For example, this happens when building
Python from source without having zlib available.
| -rw-r--r-- | mesonbuild/mdist.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py index 0361606a5..6e1bfd0ee 100644 --- a/mesonbuild/mdist.py +++ b/mesonbuild/mdist.py @@ -7,7 +7,6 @@ from __future__ import annotations import abc import argparse -import gzip import os import sys import shlex @@ -294,6 +293,7 @@ class HgDist(Dist): shutil.copyfileobj(tf, bf) output_names.append(bz2name) if 'gztar' in archives: + import gzip with gzip.open(gzname, 'wb') as zf, open(tarname, 'rb') as tf: shutil.copyfileobj(tf, zf) output_names.append(gzname) |
