fix: not working on <=3.12

This commit is contained in:
zx
2024-09-07 09:25:58 -04:00
parent 1f95e7f5fa
commit c5f5a4a4d1

View File

@@ -7,7 +7,6 @@ import subprocess
from typing import Optional from typing import Optional
from glob import glob, iglob from glob import glob, iglob
from argparse import Namespace from argparse import Namespace
from importlib import resources # type: ignore
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
@@ -92,11 +91,14 @@ def get_tools_dir() -> tuple[str, str]:
if "iPhone" in mach or "iPad" in mach: if "iPhone" in mach or "iPad" in mach:
mach = "iOS" mach = "iOS"
with resources.files() as files: # type: ignore # thank god i dont have to use importlib,
return ( # it's the WORST standard library package prior to 3.12
str(files), # type: ignore install_dir = os.path.dirname(__file__)
str(files / "tools" / system / mach) # type: ignore
) return (
install_dir,
f"{install_dir}/tools/{system}/{mach}"
)
def delete_if_exists(path: str, bn: str) -> bool: def delete_if_exists(path: str, bn: str) -> bool: