From 316e4ae60973730e3c180148557060262bce6ef0 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 14 Mar 2017 19:31:47 +0900 Subject: [PATCH] install pip under PACKAGE_DESTINATION instead of GLOBAL_DESTINATION --- CMakeLists.txt | 2 ++ cmake/catkin-pip-requirements.cmake.in | 10 +++++++++- cmake/catkin-pip-setup.cmake.in | 1 + cmake/templates/python.in | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 cmake/templates/python.in diff --git a/CMakeLists.txt b/CMakeLists.txt index fcf87d3..4166057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ configure_file(cmake/env-hooks/42.site_packages.sh.develspace.in ${CATKIN_DEVEL_ configure_file(cmake/env-hooks/42.site_packages.bash.develspace.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/env-hooks/42.site_packages.bash.develspace.in COPYONLY) #configure_file(cmake/templates/python_setuptools_install.bat.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/templates/python_setuptools_install.bat.in COPYONLY) configure_file(cmake/templates/python_setuptools_install.sh.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/templates/python_setuptools_install.sh.in COPYONLY) +configure_file(cmake/templates/python.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/templates/python.in COPYONLY) # to be found in install space and from package install(FILES @@ -62,6 +63,7 @@ install(FILES install(PROGRAMS # cmake/templates/python_setuptools_install.bat.in cmake/templates/python_setuptools_install.sh.in + cmake/templates/python.in DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/templates ) diff --git a/cmake/catkin-pip-requirements.cmake.in b/cmake/catkin-pip-requirements.cmake.in index 38aef06..0d7a377 100644 --- a/cmake/catkin-pip-requirements.cmake.in +++ b/cmake/catkin-pip-requirements.cmake.in @@ -28,6 +28,14 @@ function(catkin_pip_requirements requirements_txt) catkin_pip_setup_prefix(${CATKIN_PIP_ENV}) # runnig the pip command (configure time) - catkin_pip_runcmd(${CATKIN_PIP} install ${ARGN} -r ${requirements_txt} --ignore-installed --src ${CMAKE_SOURCE_DIR} --exists-action b --prefix "${CATKIN_DEVEL_PREFIX}") + catkin_pip_runcmd(${CATKIN_PIP} install ${ARGN} -r ${requirements_txt} --ignore-installed --src ${CMAKE_SOURCE_DIR} --exists-action b --prefix "${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}") ## somehow we could not use CATKIN_PACKAGE_SHARE_DESTINATION here + + install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/${CATKIN_PIP_GLOBAL_PYTHON_DESTINATION} + DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/${CATKIN_PIP_GLOBAL_PYTHON_DESTINATION}) + # for devel + set (CATKIN_PIP_GLOBAL_PYTHON_DESTINATION "lib/python2.7/site-packages") # ???? why we need at here???? + configure_file(${CATKIN_PIP_TEMPLATES_PATH}/python.in ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_LIBEXEC_DESTINATION}/${PROJECT_NAME}/python) + # for install + install(CODE "configure_file(${CATKIN_PIP_TEMPLATES_PATH}/python.in ${CATKIN_GLOBAL_LIBEXEC_DESTINATION}/${PROJECT_NAME}/python)") endfunction() diff --git a/cmake/catkin-pip-setup.cmake.in b/cmake/catkin-pip-setup.cmake.in index 68ff27e..1f0985a 100644 --- a/cmake/catkin-pip-setup.cmake.in +++ b/cmake/catkin-pip-setup.cmake.in @@ -65,6 +65,7 @@ function(catkin_pip_python_setup) ${INSTALL_SCRIPT} @ONLY) endif() + configure_file(${CATKIN_PIP_TEMPLATES_PATH}/python.in cmake/python.in @ONLY) # generate python script which gets executed at install time configure_file(${catkin_EXTRAS_DIR}/templates/safe_execute_install.cmake.in diff --git a/cmake/templates/python.in b/cmake/templates/python.in new file mode 100755 index 0000000..53d1620 --- /dev/null +++ b/cmake/templates/python.in @@ -0,0 +1,3 @@ +#!/bin/sh + +PYTHONPATH=@CATKIN_DEVEL_PREFIX@/@CATKIN_GLOBAL_SHARE_DESTINATION@/@PROJECT_NAME@/@CATKIN_PIP_GLOBAL_PYTHON_DESTINATION@:$PYTHONPATH python $@