mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 02:31:45 +02:00
Workaround Apple's "hardening" breaking the platform module
Fix #5065 Fix #5051
This commit is contained in:
@@ -974,8 +974,13 @@ def path_from_osc7_url(url: str) -> str:
|
|||||||
|
|
||||||
@run_once
|
@run_once
|
||||||
def macos_version() -> Tuple[int, ...]:
|
def macos_version() -> Tuple[int, ...]:
|
||||||
import platform
|
# platform.mac_ver does not work thanks to Apple's stupid "hardening", so just use sw_vers
|
||||||
return tuple(map(int, platform.mac_ver()[0].split('.')))
|
import subprocess
|
||||||
|
try:
|
||||||
|
o = subprocess.check_output(['sw_vers', '-productVersion'], stderr=subprocess.STDOUT).decode()
|
||||||
|
except Exception:
|
||||||
|
return 0, 0, 0
|
||||||
|
return tuple(map(int, o.strip().split('.')))
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=2)
|
@lru_cache(maxsize=2)
|
||||||
|
|||||||
Reference in New Issue
Block a user