Explorar o código

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.

(cherry picked from commit 24073568e5fa910b7a61b156f91a919bb657cf9b)
PatTheMav hai 1 ano
pai
achega
0758c2b33e
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      deps/obs-scripting/obs-scripting-python.c

+ 5 - 0
deps/obs-scripting/obs-scripting-python.c

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