Sfoglia il codice sorgente

Merge pull request #2183 from ratwithacompiler/macos-python-fix-2

obs-scripting: Fix Python in new MacOS .app bundles
Jim 6 anni fa
parent
commit
e99b542b72

+ 3 - 3
CI/before-deploy-osx.sh

@@ -22,9 +22,9 @@ hr "Moving OBS LUA"
 mv ./rundir/RelWithDebInfo/data/obs-scripting/obslua.so ./rundir/RelWithDebInfo/bin/
 mv ./rundir/RelWithDebInfo/data/obs-scripting/obslua.so ./rundir/RelWithDebInfo/bin/
 
 
 # Move obspython
 # Move obspython
-# hr "Moving OBS Python"
-# mv ./rundir/RelWithDebInfo/data/obs-scripting/_obspython.so ./rundir/RelWithDebInfo/bin/
-# mv ./rundir/RelWithDebInfo/data/obs-scripting/obspython.py ./rundir/RelWithDebInfo/bin/
+hr "Moving OBS Python"
+mv ./rundir/RelWithDebInfo/data/obs-scripting/_obspython.so ./rundir/RelWithDebInfo/bin/
+mv ./rundir/RelWithDebInfo/data/obs-scripting/obspython.py ./rundir/RelWithDebInfo/bin/
 
 
 # Package everything into a nice .app
 # Package everything into a nice .app
 hr "Packaging .app"
 hr "Packaging .app"

+ 1 - 0
CI/install/osx/packageApp.sh

@@ -35,6 +35,7 @@ cp ../CI/install/osx/Info.plist ./OBS.app/Contents
 -x ./OBS.app/Contents/MacOS/obs \
 -x ./OBS.app/Contents/MacOS/obs \
 -x ./OBS.app/Contents/MacOS/obs-ffmpeg-mux \
 -x ./OBS.app/Contents/MacOS/obs-ffmpeg-mux \
 -x ./OBS.app/Contents/MacOS/obslua.so \
 -x ./OBS.app/Contents/MacOS/obslua.so \
+-x ./OBS.app/Contents/MacOS/_obspython.so \
 -x ./OBS.app/Contents/Plugins/obs-x264.so \
 -x ./OBS.app/Contents/Plugins/obs-x264.so \
 -x ./OBS.app/Contents/Plugins/text-freetype2.so \
 -x ./OBS.app/Contents/Plugins/text-freetype2.so \
 -x ./OBS.app/Contents/Plugins/obs-libfdk.so
 -x ./OBS.app/Contents/Plugins/obs-libfdk.so

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

@@ -1651,6 +1651,13 @@ bool obs_scripting_load_python(const char *python_path)
 
 
 	add_to_python_path(SCRIPT_DIR);
 	add_to_python_path(SCRIPT_DIR);
 
 
+#if __APPLE__
+	char *exec_path = os_get_executable_path_ptr("");
+	if (exec_path)
+		add_to_python_path(exec_path);
+	bfree(exec_path);
+#endif
+
 	py_obspython = PyImport_ImportModule("obspython");
 	py_obspython = PyImport_ImportModule("obspython");
 	bool success = !py_error();
 	bool success = !py_error();
 	if (!success) {
 	if (!success) {