[Bf-blender-cvs] [086320a62e1] master: CMake: WITH_PYTHON_SECURITY=OFF was ignored

Campbell Barton noreply at git.blender.org
Mon Mar 27 04:08:28 CEST 2017


Commit: 086320a62e108b6e640f2b2453b8f1f0a946e57b
Author: Campbell Barton
Date:   Mon Mar 27 13:02:41 2017 +1100
Branches: master
https://developer.blender.org/rB086320a62e108b6e640f2b2453b8f1f0a946e57b

CMake: WITH_PYTHON_SECURITY=OFF was ignored

Allow auto-execution to be enabled,
also move this to user-prefs versioning code.

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

M	source/blender/blenloader/CMakeLists.txt
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/windowmanager/CMakeLists.txt
M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 8cb9ef837b2..3d2e8a306de 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -69,6 +69,12 @@ if(WITH_BUILDINFO)
 	add_definitions(-DWITH_BUILDINFO)
 endif()
 
+if(WITH_PYTHON)
+	if(WITH_PYTHON_SECURITY)
+		add_definitions(-DWITH_PYTHON_SECURITY)
+	endif()
+endif()
+
 if(WITH_INTERNATIONAL)
 	add_definitions(-DWITH_INTERNATIONAL)
 endif()
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 6145b90b406..e34f12b1cf9 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -72,6 +72,14 @@ void BLO_update_defaults_userpref_blend(void)
 	/* default so DPI is detected automatically */
 	U.dpi = 0;
 	U.ui_scale = 1.0f;
+
+#ifdef WITH_PYTHON_SECURITY
+	/* use alternative setting for security nuts
+	 * otherwise we'd need to patch the binary blob - startup.blend.c */
+	U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
+#else
+	U.flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
+#endif
 }
 
 /**
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index b6245a8c0d1..925563a0777 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -128,10 +128,6 @@ if(WITH_PYTHON)
 		../python
 	)
 	add_definitions(-DWITH_PYTHON)
-
-	if(WITH_PYTHON_SECURITY)
-		add_definitions(-DWITH_PYTHON_SECURITY)
-	endif()
 endif()
 
 if(WITH_GAMEENGINE)
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 826cf490f53..27395dbaf3e 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -777,11 +777,6 @@ int wm_homefile_read(
 		if (BLI_listbase_is_empty(&wmbase)) {
 			wm_clear_default_size(C);
 		}
-#ifdef WITH_PYTHON_SECURITY
-		/* use alternative setting for security nuts
-		 * otherwise we'd need to patch the binary blob - startup.blend.c */
-		U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
-#endif
 	}
 
 	/* Load template preferences,




More information about the Bf-blender-cvs mailing list