obs-scripting: Fix Sparkle delta updates by disabling bytecode caching

Python automatically creates bytecode caches which end up inside the
application bundle of OBS Studio on macOS. These directories will lead
to a hash mismatch when Sparkle attempts to apply a delta update (to
ensure that the patch can be applied).

As the added directories will make the hash check fail, having a valid
Python framework configured in OBS Studio (even without any script
added) will thus prevent Sparkle from using delta updates.
This commit is contained in:
PatTheMav 2023-11-04 19:28:47 +01:00 committed by Lain
parent bee71b32d2
commit 24073568e5

View File

@ -1706,6 +1706,11 @@ bool obs_scripting_load_python(const char *python_path)
PySys_SetArgv(argc, argv);
PRAGMA_WARN_POP
#ifdef __APPLE__
PyRun_SimpleString("import sys");
PyRun_SimpleString("sys.dont_write_bytecode = True");
#endif
#ifdef DEBUG_PYTHON_STARTUP
/* ---------------------------------------------- */
/* Debug logging to file if startup is failing */