From 24073568e5fa910b7a61b156f91a919bb657cf9b Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Sat, 4 Nov 2023 19:28:47 +0100 Subject: [PATCH] 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. --- deps/obs-scripting/obs-scripting-python.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deps/obs-scripting/obs-scripting-python.c b/deps/obs-scripting/obs-scripting-python.c index 3a4f9fbf6..335eb3c86 100644 --- a/deps/obs-scripting/obs-scripting-python.c +++ b/deps/obs-scripting/obs-scripting-python.c @@ -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 */