diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-07-28 18:42:30 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-07-28 18:53:02 +0400 |
commit | c85265b4551acbc7adf41f47f612373e42e0176d (patch) | |
tree | 49cbc3a2b1cd0741250946c8b56e0b5d34d55f44 /CMakeLists.txt | |
parent | c4b47b89f76d259792b3a8f0f9b6718668996000 (diff) |
Make requests python package to be detected in the same way as numpy
This solves missing requests package reported on the systems where it's
located in dist-packages rather than in site-packages.
To do this there's now a helper macros which handles both requests and
numpy now and could be used for more packages in the future.
Reviewers: campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D686
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9de92af9a82..9f32f79049b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,11 +257,13 @@ if(UNIX AND NOT APPLE) endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON) -set(PYTHON_NUMPY_PATH "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module") +set(PYTHON_NUMPY_PATH "" CACHE PATH "Path 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) + set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module") + mark_as_advanced(PYTHON_REQUESTS_PATH) endif() # Cycles @@ -2245,62 +2247,13 @@ if(WITH_PYTHON) if(WIN32) # pass, we have this in an archive to extract elseif(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) - # set but invalid - # -- disabled until we make numpy bundled with blender - campbell - if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND)) -# if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy") -# message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' " -# "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") -# set(WITH_PYTHON_INSTALL_NUMPY OFF) -# endif() - # not set, so initialize - else() - string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}") - list(GET _PY_VER_SPLIT 0 _PY_VER_MAJOR) - - # re-cache - unset(PYTHON_NUMPY_PATH CACHE) - find_path(PYTHON_NUMPY_PATH - NAMES - numpy - HINTS - "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/" - "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/" - PATH_SUFFIXES - site-packages - dist-packages - NO_DEFAULT_PATH - ) - - if(NOT EXISTS "${PYTHON_NUMPY_PATH}") - message(WARNING "'numpy' path could not be found in:\n" - "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy', " - "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/numpy', " - "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/numpy', " - "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/numpy', " - "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") - set(WITH_PYTHON_INSTALL_NUMPY OFF) - else() - message(STATUS "numpy found at '${PYTHON_NUMPY_PATH}'") - endif() - - unset(_PY_VER_SPLIT) - unset(_PY_VER_MAJOR) - endif() + find_python_package(numpy) 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) - # gets annoying otherwise... - if(FIRST_RUN) - 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") - endif() - set(WITH_PYTHON_INSTALL_REQUESTS OFF) - endif() + find_python_package(requests) endif() endif() |