From a926675c35125074a007a13afea2678bbe112c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 27 Jul 2024 21:37:43 +0000 Subject: [PATCH] bootstrap: fix DeprecationWarning DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior. See: https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter --- utils/bootstrap.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/bootstrap.py b/utils/bootstrap.py index c0eff0a00..fb4c36b0a 100755 --- a/utils/bootstrap.py +++ b/utils/bootstrap.py @@ -19,6 +19,7 @@ import tarfile import zipfile from argparse import ArgumentParser from pathlib import Path +from tarfile import TarFile from urllib.request import urlretrieve project_root_dir = Path(__file__).resolve().parent.parent @@ -92,7 +93,11 @@ def download_and_unzip(url: str, directory: Path): obj = tarfile.open(f) else: obj = zipfile.ZipFile(f, 'r') - obj.extractall(path=str(extract_dir)) + + if isinstance(obj, TarFile): + obj.extractall(path=str(extract_dir), filter='data') + else: # Zip file + obj.extractall(path=str(extract_dir)) subdir = find_single_subdir(extract_dir) shutil.move(str(subdir), str(directory))