Workaround for Python 3.11 breaking sys._xoptions

Apparently in Python-land its acceptable behavior to break backward
compatibility with documented interfaces on a whim. Bloody joke.
https://github.com/python/cpython/pull/28823

Fixes #5223
This commit is contained in:
Kovid Goyal
2022-06-23 08:44:34 +05:30
parent 5673359be2
commit f023f047ff
6 changed files with 33 additions and 44 deletions

View File

@@ -29,7 +29,7 @@ is_macos: bool = 'darwin' in _plat
is_freebsd: bool = 'freebsd' in _plat
is_running_from_develop: bool = False
if getattr(sys, 'frozen', False):
extensions_dir: str = getattr(sys, 'kitty_extensions_dir')
extensions_dir: str = getattr(sys, 'kitty_run_data')['extensions_dir']
def get_frozen_base() -> str:
global is_running_from_develop
@@ -61,7 +61,7 @@ else:
@run_once
def kitty_exe() -> str:
rpath = sys._xoptions.get('bundle_exe_dir')
rpath = getattr(sys, 'kitty_run_data').get('bundle_exe_dir')
if not rpath:
items = os.environ.get('PATH', '').split(os.pathsep) + [os.path.join(kitty_base_dir, 'kitty', 'launcher')]
seen: Set[str] = set()