Skip to content

Commit

Permalink
Fix python install path on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwason committed Jan 18, 2024
1 parent db96dcc commit b768902
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
5 changes: 4 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% set opw_kinematics_version = "0.5.0" %}
{% set tesseract_version = "0.21.5" %}
{% set tesseract_planning_version = "0.21.6" %}
{% set tesseract_python_version = "0.4.0" %}
{% set trajopt_version = "0.7.2" %}
{% set descartes_light_version = "0.4.2" %}
{% set ruckig_version = "0.12.2" %}
Expand Down Expand Up @@ -30,8 +31,10 @@ source:
folder: src/ruckig
patches:
- ruckig-install-header-files.patch
- url: https://github.com/johnwason/tesseract_python-1/archive/refs/heads/update_dec_2023_1.tar.gz
- url: https://github.com/tesseract-robotics/tesseract_python/archive/refs/tags/{{ tesseract_python_version }}.tar.gz
folder: src
patches:
- tesseract-python-pip-install.patch

requirements:
build:
Expand Down
42 changes: 42 additions & 0 deletions recipe/tesseract-python-pip-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/tesseract_python/CMakeLists.txt b/tesseract_python/CMakeLists.txt
index 9f664a7..4820a9d 100644
--- a/tesseract_python/CMakeLists.txt
+++ b/tesseract_python/CMakeLists.txt
@@ -179,15 +179,11 @@ if(SETUPTOOLS_DEB_LAYOUT)
set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb")
endif()

-if (${PYTHON_VERSION_MAJOR} LESS 3)
- install(CODE "message(STATUS \"Running setup.py in ${CMAKE_CURRENT_BINARY_DIR}/python\")
- execute_process(COMMAND python2 setup.py install -f
---root=/ --prefix=${CMAKE_INSTALL_PREFIX} ${SETUPTOOLS_ARG_EXTRA} --single-version-externally-managed WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python)")
-else()
- install(CODE "message(STATUS \"Running setup.py in ${CMAKE_CURRENT_BINARY_DIR}/python\")
- execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py install -f
- --root=/ --prefix=${CMAKE_INSTALL_PREFIX} ${SETUPTOOLS_ARG_EXTRA} --single-version-externally-managed WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python)")
-endif()
+
+ install(CODE "message(STATUS \"Running pip setup in ${CMAKE_CURRENT_BINARY_DIR}/python\")
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --no-deps --ignore-installed
+ --target=${CMAKE_INSTALL_PREFIX}/lib/python3/dist-packages . ${SETUPTOOLS_ARG_EXTRA} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python COMMAND_ERROR_IS_FATAL ANY)")
+


# Allows Colcon to find non-Ament packages when using workspace underlays
diff --git a/tesseract_viewer_python/CMakeLists.txt b/tesseract_viewer_python/CMakeLists.txt
index 5f233f9..248cc76 100644
--- a/tesseract_viewer_python/CMakeLists.txt
+++ b/tesseract_viewer_python/CMakeLists.txt
@@ -43,9 +43,9 @@ if(SETUPTOOLS_DEB_LAYOUT)
set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb")
endif()

-install(CODE "message(STATUS \"Running setup.py in ${CMAKE_CURRENT_SOURCE_DIR}\")
-execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py install -f
---root=/ --prefix=${CMAKE_INSTALL_PREFIX} ${SETUPTOOLS_ARG_EXTRA} --single-version-externally-managed WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
+install(CODE "message(STATUS \"Running pip setup in ${CMAKE_CURRENT_SOURCE_DIR}\")
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --no-deps --ignore-installed
+--target=${CMAKE_INSTALL_PREFIX}/lib/python3/dist-packages . WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND_ERROR_IS_FATAL ANY)")

# Allows Colcon to find non-Ament packages when using workspace underlays
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} "")

0 comments on commit b768902

Please sign in to comment.