Build system: add cmake option to install requests
authorCampbell Barton <ideasman42@gmail.com>
Tue, 4 Mar 2014 18:39:53 +0000 (05:39 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 4 Mar 2014 18:40:47 +0000 (05:40 +1100)
CMakeLists.txt
source/creator/CMakeLists.txt

index 46690f3a5b75e9120f5d0904077e7ada2f4c3988..169aeffdbefe65d3a25b357ae97f45ebc2956c3d 100644 (file)
@@ -265,6 +265,10 @@ option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install fol
 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
 mark_as_advanced(PYTHON_NUMPY_PATH)
 
+if(UNIX AND NOT APPLE)
+       option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON)
+endif()
+
 # Cycles
 option(WITH_CYCLES                                     "Enable cycles Render Engine" ON)
 option(WITH_CYCLES_STANDALONE          "Build cycles standalone application" OFF)
@@ -2255,6 +2259,17 @@ if(WITH_PYTHON)
                        unset(_PY_VER_MAJOR)
                endif()
        endif()
+
+       if(WIN32 OR APPLE)
+               # pass, we have this in lib/python/site-packages
+       elseif(WITH_PYTHON_INSTALL_REQUESTS)
+               if(NOT EXISTS ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/requests)
+                       message(WARNING "'requests' path could not be found in:\n"
+                                       "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/requests'\n"
+                                       "WITH_PYTHON_INSTALL_REQUESTS option will be ignored when installing python")
+                       set(WITH_PYTHON_INSTALL_REQUESTS OFF)
+               endif()
+       endif()
 endif()
 
 if(WITH_GCC_MUDFLAP)
index 0f8de9f80b56c5c6ab146de40b2c511a4550d824..10421ef5fb9c1c066b9947b8b0ba6f66801098de 100644 (file)
@@ -522,7 +522,19 @@ if(UNIX AND NOT APPLE)
                                        PATTERN "*.a" EXCLUDE                   # ./core/lib/libnpymath.a - for linking, we dont need.
                                )
                        endif()
-                       
+
+                       # Copy requests, we need to generalize site-packages
+                       if(WITH_PYTHON_INSTALL_REQUESTS)
+                               install(
+                                       DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/requests
+                                       DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/site-packages
+                                       PATTERN ".svn" EXCLUDE
+                                       PATTERN "__pycache__" EXCLUDE           # * any cache *
+                                       PATTERN "*.pyc" EXCLUDE                 # * any cache *
+                                       PATTERN "*.pyo" EXCLUDE                 # * any cache *
+                                       PATTERN "cacert.pem" EXCLUDE            # for now we don't deal with security
+                               )
+                       endif()
                        unset(_target_LIB)
                        
                endif()