fix install on older systems

This commit is contained in:
Mateusz Gruszczyński
2025-10-26 16:31:33 +01:00
parent 71f8049b55
commit da4b2cad57

View File

@@ -296,8 +296,13 @@ def download_extract_tar_gz(url: str, dest_dir: Path) -> Path:
with tarfile.open(tf_path, "r:gz") as t: with tarfile.open(tf_path, "r:gz") as t:
try: try:
t.extractall(dest_dir, filter="data") t.extractall(dest_dir, filter="data")
except (TypeError, tarfile.LinkOutsideDestinationError): except TypeError:
t.extractall(dest_dir) t.extractall(dest_dir)
except Exception as e:
if 'LinkOutsideDestinationError' in str(type(e).__name__):
t.extractall(dest_dir)
else:
raise
top = t.getmembers()[0].name.split("/")[0] top = t.getmembers()[0].name.split("/")[0]
os.unlink(tf_path) os.unlink(tf_path)
return dest_dir / top return dest_dir / top