[Bf-blender-cvs] [aa8fc57] master: Fix for Python executable not being found on Linux

Campbell Barton noreply at git.blender.org
Mon Feb 15 09:14:29 CET 2016


Commit: aa8fc57f1e7683e0490fad5dc2fc18bdba2cee5b
Author: Campbell Barton
Date:   Mon Feb 15 19:01:28 2016 +1100
Branches: master
https://developer.blender.org/rBaa8fc57f1e7683e0490fad5dc2fc18bdba2cee5b

Fix for Python executable not being found on Linux

Python name could include ABI-flags after the version,
since checking for all combinations of ABI flags can expand into many possibilities,
take the executable name from the build system.

===================================================================

M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/appdir.c

===================================================================

diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 7177ddc..7311f33 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -412,6 +412,13 @@ if(WITH_PYTHON)
 	if(WITH_PYTHON_SECURITY)
 		add_definitions(-DWITH_PYTHON_SECURITY)
 	endif()
+
+
+	if (PYTHON_EXECUTABLE)
+		get_filename_component(_python_exe_name ${PYTHON_EXECUTABLE} NAME)
+		add_definitions(-DPYTHON_EXECUTABLE_NAME=${_python_exe_name})
+		unset(_python_exe_name)
+	endif()
 endif()
 
 if(WITH_MOD_FLUID)
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index dd961ea..de21d91 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -597,10 +597,20 @@ bool BKE_appdir_program_python_search(
         char *fullpath, const size_t fullpath_len,
         const int version_major, const int version_minor)
 {
+#ifdef PYTHON_EXECUTABLE_NAME
+	/* passed in from the build-systems 'PYTHON_EXECUTABLE' */
+	const char *python_build_def = STRINGIFY(PYTHON_EXECUTABLE_NAME);
+#endif
 	const char *basename = "python";
 	char python_ver[16];
 	/* check both possible names */
-	const char *python_names[] = {python_ver, basename};
+	const char *python_names[] = {
+#ifdef PYTHON_EXECUTABLE_NAME
+		python_build_def,
+#endif
+		python_ver,
+		basename,
+	};
 	int i;
 
 	bool is_found = false;




More information about the Bf-blender-cvs mailing list