mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 07:28:25 +00:00
fix: version check before AbsoluteLinkError
This commit is contained in:
parent
80f2e70af6
commit
3502c776c0
@ -9,7 +9,7 @@ from functools import lru_cache
|
||||
from glob import glob
|
||||
from pathlib import Path
|
||||
from shlex import split
|
||||
from tarfile import AbsoluteLinkError, TarInfo
|
||||
from tarfile import TarInfo
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
# imports - third party imports
|
||||
@ -578,11 +578,12 @@ def get_app_cache_extract_filter(
|
||||
): # -> Callable[[TarInfo, str], TarInfo | None]
|
||||
state = dict(count=0, size=0)
|
||||
|
||||
if sys.version_info.major <=2 or sys.version_info.minor <=8:
|
||||
def data_filter(m, p):
|
||||
return m
|
||||
else:
|
||||
from tarfile import data_filter
|
||||
AbsoluteLinkError = Exception
|
||||
def data_filter(m: TarInfo, _:str) -> TarInfo:
|
||||
return m
|
||||
|
||||
if (sys.version_info.major == 3 and sys.version_info.minor > 7) or sys.version_info.major > 3:
|
||||
from tarfile import data_filter, AbsoluteLinkError
|
||||
|
||||
def filter_function(member: TarInfo, dest_path: str) -> Optional[TarInfo]:
|
||||
state["count"] += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user