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

@@ -36,6 +36,8 @@ def main() -> None:
paths = os.environ.get('PATH', '/usr/local/sbin:/usr/local/bin:/usr/bin').split(os.pathsep)
path = os.pathsep.join(x for x in paths if not x.startswith(current_home))
launcher_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kitty', 'launcher')
if not hasattr(sys, 'kitty_run_data'):
setattr(sys, 'kitty_run_data', {'bundle_exe_dir': launcher_dir, 'from_source': True})
path = f'{launcher_dir}{os.pathsep}{path}'
with TemporaryDirectory() as tdir, env_vars(
PYTHONWARNINGS='error', HOME=tdir, USERPROFILE=tdir, PATH=path,