瀏覽代碼

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 1 年之前
父節點
當前提交
0758c2b33e
共有 1 個文件被更改,包括 5 次插入0 次删除
  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);
 	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    */