[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30779] trunk/blender: patch [#23041] CMake WITH_PYTHON_INSTALL option

Campbell Barton ideasman42 at gmail.com
Tue Jul 27 01:16:22 CEST 2010


Revision: 30779
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30779
Author:   campbellbarton
Date:     2010-07-27 01:16:21 +0200 (Tue, 27 Jul 2010)

Log Message:
-----------
patch [#23041] CMake WITH_PYTHON_INSTALL option
from Dan Eicher (dna)

--- snip ---
Adds the option to not copy python into the .blender/python directory.

Also fixes the problem of deleting the blender installed python where the blender runtime only looks for the copied python and not the system one but not entirely sure why, something to do with CMake hardcoding the PYTHONPATH and PYTHONHOME vars I suppose.

This patch only applies to the 'UNIX AND NOT APPLE' platforms but, then again, those are the only ones anyone really
cares about...or at least the only ones where using the system python is really viable.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/source/creator/CMakeLists.txt

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2010-07-26 22:33:58 UTC (rev 30778)
+++ trunk/blender/CMakeLists.txt	2010-07-26 23:16:21 UTC (rev 30779)
@@ -115,6 +115,7 @@
 OPTION(WITH_RAYOPTIMIZATION	"Enable use of SIMD (SSE) optimizations for the raytracer" ON) 
 OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking" OFF)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
+OPTION(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 
 IF(APPLE)
 	OPTION(WITH_COCOA	  "Use Cocoa framework instead of deprecated Carbon" ON)
@@ -130,6 +131,10 @@
 	MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 
+IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
+	MESSAGE("WARNING: WITH_PYTHON_INSTALL needs WITH_INSTALL")
+ENDIF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
+
 TEST_SSE_SUPPORT()
 
 # disabled for now, not supported

Modified: trunk/blender/source/creator/CMakeLists.txt
===================================================================
--- trunk/blender/source/creator/CMakeLists.txt	2010-07-26 22:33:58 UTC (rev 30778)
+++ trunk/blender/source/creator/CMakeLists.txt	2010-07-26 23:16:21 UTC (rev 30779)
@@ -143,32 +143,32 @@
 				COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/.blender/
 				COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
 			)
-      
-			# Copy the systems python into the install directory
-			# Scons copy in tools/Blender.py
-			ADD_CUSTOM_COMMAND(
-				TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-				COMMENT "copying a subset of the systems python..."
-        
-				COMMAND mkdir ${TARGETDIR}/.blender/python # PYTHONPATH and PYTHONHOME is set here
-				COMMAND mkdir ${TARGETDIR}/.blender/python/lib/
-				COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/.blender/python/lib/
-        
-				COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/distutils
-				COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib2to3
-				COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/idlelib
-				COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/tkinter
-				COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/config
-        
-				COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages
-				COMMAND mkdir ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages    # python needs it.
+			IF(WITH_PYTHON_INSTALL)
+				# Copy the systems python into the install directory
+				# Scons copy in tools/Blender.py
+				ADD_CUSTOM_COMMAND(
+					TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+					COMMENT "copying a subset of the systems python..."
 
-				COMMAND rm -f ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
-				COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
-				COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
-				COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
-			)
-     
+					COMMAND mkdir ${TARGETDIR}/.blender/python # PYTHONPATH and PYTHONHOME is set here
+					COMMAND mkdir ${TARGETDIR}/.blender/python/lib/
+					COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/.blender/python/lib/
+
+					COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/distutils
+					COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib2to3
+					COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/idlelib
+					COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/tkinter
+					COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/config
+
+					COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages
+					COMMAND mkdir ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages    # python needs it.
+
+					COMMAND rm -f ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
+					COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
+					COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
+					COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
+				)
+			ENDIF(WITH_PYTHON_INSTALL)
 		ENDIF(WITH_PYTHON)
       
 		ADD_CUSTOM_COMMAND(
@@ -177,7 +177,7 @@
 		)
     
     
-		# Above we bundle a portable distrobution in ./bin
+		# Above we bundle a portable distribution in ./bin
 		# This is an optional "make install" which installs blender on the system.
 		INSTALL(
 			PROGRAMS ${TARGETDIR}/blender





More information about the Bf-blender-cvs mailing list