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
This commit is contained in:
parent
ff16bfd8fa
commit
a926675c35
|
|
@ -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,6 +93,10 @@ def download_and_unzip(url: str, directory: Path):
|
|||
obj = tarfile.open(f)
|
||||
else:
|
||||
obj = zipfile.ZipFile(f, 'r')
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue