Skip to content

Commit d802447

Browse files
authored
Merge pull request #23 from johnwason/pr/UpstreamChanges5
Update Python to upstream changes, add logging and wheel support
2 parents 8d9db16 + 7cd8c93 commit d802447

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+697
-376
lines changed

.github/workflows/bionic_build.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/windows_noetic_build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ jobs:
2424
shell: cmd
2525
run: |
2626
choco sources add -n=roswin -s https://aka.ms/ros/public --priority 1
27+
if %errorlevel% neq 0 exit /b %errorlevel%
2728
choco install ros-%ROS_DISTRO%-desktop_full -y --no-progress
29+
if %errorlevel% neq 0 exit /b %errorlevel%
2830
choco install swig
31+
C:/opt/ros/noetic/x64/python.exe -m pip uninstall pytest-rerunfailures -y
32+
if %errorlevel% neq 0 exit /b %errorlevel%
2933
3034
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64
3135
call "C:\opt\ros\%ROS_DISTRO%\x64\setup.bat"
@@ -35,9 +39,12 @@ jobs:
3539
rosdep update
3640
3741
vcs import --input "${{ github.workspace }}/src/tesseract_python/dependencies_with_ext.rosinstall" src/
38-
42+
3943
rosdep install -q --from-paths . --ignore-src -y
40-
41-
catkin_make_isolated --install --use-nmake --force-cmake --only-pkg-with-deps tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=C:/opt/ros/noetic/x64/python.exe -DPYTHON_LIBRARY=C:/opt/ros/noetic/x64/Lib/python38.lib -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON
42-
call "D:\a\tesseract_python\tesseract_python\install_isolated\setup.bat"
43-
catkin_make_isolated --install --use-nmake --force-cmake --pkg tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=C:/opt/ros/noetic/x64/python.exe -DPYTHON_LIBRARY=C:/opt/ros/noetic/x64/Lib/python38.lib -DTESSERACT_ENABLE_TESTING=ON -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON
44+
45+
catkin_make_isolated --install --use-ninja --force-cmake --only-pkg-with-deps tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=C:/opt/ros/noetic/x64/python.exe -DPYTHON_LIBRARY=C:/opt/ros/noetic/x64/Lib/python38.lib -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON -DNO_OPENCL=ON
46+
if %errorlevel% neq 0 exit /b %errorlevel%
47+
call "%CD%\install_isolated\setup.bat"
48+
set TESSERACT_SUPPORT_DIR=%CD%\src\tesseract\tesseract_support
49+
C:/opt/ros/noetic/x64/python.exe -m pytest src\tesseract_python\tesseract_python
50+
if %errorlevel% neq 0 exit /b %errorlevel%

dependencies.rosinstall

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
- git:
22
local-name: ros_industrial_cmake_boilerplate
33
uri: https://github.com/ros-industrial/ros_industrial_cmake_boilerplate.git
4-
version: 0.2.14
4+
version: 0.3.0
55

66
- git:
77
local-name: tesseract
8-
uri: https://github.com/tesseract-robotics/tesseract.git
9-
version: 3a14e2a071a06c60763c0ea985de539fba7341b2
8+
uri: https://github.com/johnwason/tesseract.git
9+
version: pr/BulletLibsAbsPath
1010
- git:
1111
local-name: tesseract_planning
1212
uri: https://github.com/tesseract-robotics/tesseract_planning.git
13-
version: 1627231f3de8118f48d19272d0a7ac43dfe2f98a
13+
version: 0c0983699f4afab3251daae6665bc0c9336f97f0
1414
- git:
1515
local-name: trajopt
1616
uri: https://github.com/tesseract-robotics/trajopt.git
17-
version: 0.2.0
17+
version: 0.3.0
1818
- git:
1919
local-name: descartes_light
2020
uri: https://github.com/swri-robotics/descartes_light.git
21-
version: 0.3.0
21+
version: 0.3.1
2222
- git:
2323
local-name: opw_kinematics
2424
uri: https://github.com/Jmeyer1292/opw_kinematics.git
25-
version: 0.4.4
25+
version: 0.4.6
2626
- git:
2727
local-name: ifopt
2828
uri: https://github.com/ethz-adrl/ifopt.git
29-
version: 2.1.2
29+
version: 2.1.3

dependencies_with_ext.rosinstall

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
- git:
22
local-name: ros_industrial_cmake_boilerplate
33
uri: https://github.com/ros-industrial/ros_industrial_cmake_boilerplate.git
4-
version: 0.2.14
4+
version: 0.3.0
55

66
- git:
77
local-name: tesseract
8-
uri: https://github.com/tesseract-robotics/tesseract.git
9-
version: 3a14e2a071a06c60763c0ea985de539fba7341b2
8+
uri: https://github.com/johnwason/tesseract.git
9+
version: pr/BulletLibsAbsPath
1010
- git:
1111
local-name: tesseract_planning
1212
uri: https://github.com/tesseract-robotics/tesseract_planning.git
13-
version: 1627231f3de8118f48d19272d0a7ac43dfe2f98a
13+
version: 0c0983699f4afab3251daae6665bc0c9336f97f0
1414
- git:
1515
local-name: trajopt
1616
uri: https://github.com/tesseract-robotics/trajopt.git
17-
version: 0.2.0
17+
version: 0.3.0
1818
- git:
1919
local-name: descartes_light
2020
uri: https://github.com/swri-robotics/descartes_light.git
21-
version: 0.3.0
21+
version: 0.3.1
2222
- git:
2323
local-name: opw_kinematics
2424
uri: https://github.com/Jmeyer1292/opw_kinematics.git
25-
version: 0.4.4
25+
version: 0.4.6
2626
- git:
2727
local-name: ifopt
2828
uri: https://github.com/ethz-adrl/ifopt.git
29-
version: 2.1.2
29+
version: 2.1.3
3030
- git:
3131
local-name: tesseract_ext
3232
uri: https://github.com/tesseract-robotics/tesseract_ext.git

tesseract_python/CMakeLists.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ find_package(trajopt REQUIRED)
4141
find_package(TinyXML2 REQUIRED)
4242
find_package(opw_kinematics REQUIRED)
4343

44+
if(NOT TinyXML2_INCLUDE_DIRS AND TARGET tinyxml2::tinyxml2)
45+
get_target_property(TinyXML2_INCLUDE_DIRS tinyxml2::tinyxml2 INTERFACE_INCLUDE_DIRECTORIES)
46+
message(STATUS "Found from target interface: TinyXML2_INCLUDE_DIRS=${TinyXML2_INCLUDE_DIRS}")
47+
endif()
48+
4449
tesseract_variables()
4550

4651
include_directories(
@@ -100,6 +105,14 @@ message(STATUS "NumPy Include Directory: ${NUMPY_INCLUDE_DIR}")
100105

101106
# End Find NumPy
102107

108+
if(${CMAKE_VERSION} VERSION_GREATER "3.13.0" OR ${CMAKE_VERSION} VERSION_EQUAL "3.13.0")
109+
cmake_policy(SET CMP0078 OLD)
110+
endif()
111+
112+
if(${CMAKE_VERSION} VERSION_GREATER "3.14.0" OR ${CMAKE_VERSION} VERSION_EQUAL "3.14.0")
113+
cmake_policy(SET CMP0086 OLD)
114+
endif()
115+
103116
include(FindSWIG)
104117
find_package(SWIG 4.0 REQUIRED)
105118
include(UseSWIG)
@@ -108,12 +121,12 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tesseract_python_module.cmake)
108121

109122
tesseract_python_module(tesseract_common_python SWIG_SRCS swig/tesseract_common_python.i PACKAGE tesseract_common LIBS tesseract::tesseract_common )
110123
tesseract_python_module(tesseract_geometry_python SWIG_SRCS swig/tesseract_geometry_python.i PACKAGE tesseract_geometry LIBS tesseract::tesseract_geometry )
111-
tesseract_python_module(tesseract_collision_python SWIG_SRCS swig/tesseract_collision_python.i PACKAGE tesseract_collision LIBS tesseract::tesseract_collision_core )
124+
tesseract_python_module(tesseract_collision_python SWIG_SRCS swig/tesseract_collision_python.i PACKAGE tesseract_collision LIBS tesseract::tesseract_collision_core tesseract::tesseract_collision_bullet_factories tesseract::tesseract_collision_fcl_factories )
112125
tesseract_python_module(tesseract_scene_graph_python SWIG_SRCS swig/tesseract_scene_graph_python.i PACKAGE tesseract_scene_graph LIBS tesseract::tesseract_scene_graph )
113126
tesseract_python_module(tesseract_srdf_python SWIG_SRCS swig/tesseract_srdf_python.i PACKAGE tesseract_srdf LIBS tesseract::tesseract_srdf )
114127
tesseract_python_module(tesseract_urdf_python SWIG_SRCS swig/tesseract_urdf_python.i PACKAGE tesseract_urdf LIBS tesseract::tesseract_urdf )
115128
tesseract_python_module(tesseract_state_solver_python SWIG_SRCS swig/tesseract_state_solver_python.i PACKAGE tesseract_state_solver LIBS tesseract::tesseract_state_solver_core tesseract::tesseract_state_solver_ofkt tesseract::tesseract_state_solver_kdl)
116-
tesseract_python_module(tesseract_kinematics_python SWIG_SRCS swig/tesseract_kinematics_python.i PACKAGE tesseract_kinematics LIBS tesseract::tesseract_kinematics_core )
129+
tesseract_python_module(tesseract_kinematics_python SWIG_SRCS swig/tesseract_kinematics_python.i PACKAGE tesseract_kinematics LIBS tesseract::tesseract_kinematics_kdl_factories tesseract::tesseract_kinematics_ur_factory tesseract::tesseract_kinematics_opw_factory tesseract::tesseract_kinematics_core_factories tesseract::tesseract_kinematics_core )
117130
tesseract_python_module(tesseract_environment_python SWIG_SRCS swig/tesseract_environment_python.i PACKAGE tesseract_environment LIBS tesseract::tesseract_environment )
118131
tesseract_python_module(tesseract_visualization_python SWIG_SRCS swig/tesseract_visualization_python.i PACKAGE tesseract_visualization LIBS tesseract::tesseract_visualization)
119132
tesseract_python_module(tesseract_command_language_python SWIG_SRCS swig/tesseract_command_language_python.i PACKAGE tesseract_command_language LIBS tesseract::tesseract_command_language)
@@ -125,11 +138,14 @@ tesseract_python_module(tesseract_motion_planners_descartes_python SWIG_SRCS swi
125138
tesseract_python_module(tesseract_time_parameterization_python SWIG_SRCS swig/tesseract_time_parameterization_python.i PACKAGE tesseract_time_parameterization LIBS tesseract::tesseract_time_parameterization )
126139
tesseract_python_module(tesseract_process_managers_python SWIG_SRCS swig/tesseract_process_managers_python.i PACKAGE tesseract_process_managers LIBS tesseract::tesseract_process_managers )
127140

141+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/setup.py.in" "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py" @ONLY)
128142
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/__package_init__.py.in ${CMAKE_CURRENT_BINARY_DIR}/python/tesseract_robotics/__init__.py @ONLY)
129143

144+
option(TESSERACT_PYTHON_BUILD_WHEEL "Build self contained Python wheel")
145+
if(NOT TESSERACT_PYTHON_BUILD_WHEEL)
146+
130147
#install(CODE "MESSAGE(\"INSTALL TODO!\")")
131148

132-
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/setup.py.in" "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py" @ONLY)
133149

134150
set(enable_setuptools_deb_layout OFF)
135151
if(EXISTS "/etc/debian_version")
@@ -196,3 +212,10 @@ if(TESSERACT_ENABLE_TESTING)
196212

197213

198214
endif()
215+
216+
else()
217+
218+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install_build_wheel.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/install_build_wheel.cmake @ONLY)
219+
220+
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install_build_wheel.cmake)
221+
endif()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def _tesseract_dll_path_():
2+
import sys
3+
import os
4+
if sys.platform == "win32" and sys.version_info[:2] >= (3, 8):
5+
tesseract_env_path = os.environ.get("TESSERACT_PYTHON_DLL_PATH",None)
6+
if tesseract_env_path:
7+
for p in tesseract_env_path.split(os.pathsep):
8+
os.add_dll_directory(p)
9+
10+
_tesseract_dll_path_()
11+
del _tesseract_dll_path_
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
message(STATUS "Running install_build_wheel.cmake")
3+
4+
if(WIN32)
5+
execute_process(COMMAND @PYTHON_EXECUTABLE@ setup.py bdist_wheel WORKING_DIRECTORY python)
6+
file(GLOB wheel_files "${CMAKE_CURRENT_LIST_DIR}/python/dist/*.whl")
7+
foreach(wheel_file ${wheel_files})
8+
execute_process(COMMAND @PYTHON_EXECUTABLE@ -m delvewheel repair --no-dll msvcp140.dll\;vcomp140.dll ${wheel_file} WORKING_DIRECTORY python)
9+
endforeach()
10+
11+
else()
12+
execute_process(COMMAND @PYTHON_EXECUTABLE@ setup.py bdist_wheel --plat-name=@TESSERACT_PYTHON_WHEEL_PLATFORM@ WORKING_DIRECTORY python)
13+
file(GLOB wheel_files "${CMAKE_CURRENT_LIST_DIR}/python/dist/*.whl")
14+
foreach(wheel_file ${wheel_files})
15+
execute_process(COMMAND @PYTHON_EXECUTABLE@ -m auditwheel repair --plat @TESSERACT_PYTHON_WHEEL_PLATFORM@ ${wheel_file} WORKING_DIRECTORY python)
16+
endforeach()
17+
endif()

tesseract_python/cmake/setup.py.in

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,103 @@
11
# Based on https://github.com/robotraconteur/robotraconteur/blob/master/RobotRaconteurPython/setup.py.in
22

3-
from setuptools import setup, Distribution, find_packages
3+
from setuptools import setup, Distribution, find_packages, Extension
44

55
# Suggested at https://stackoverflow.com/questions/24071491/how-can-i-make-a-python-wheel-from-an-existing-native-library
66
class BinaryDistribution(Distribution):
7+
def is_pure(foo):
8+
return False
79
def has_ext_modules(foo):
810
return True
911

10-
setup(name='tesseract_robotics',
12+
# Suggested at https://stackoverflow.com/questions/51522248/overriding-python-setuptools-default-include-dirs-and-library-dirs
13+
14+
from setuptools.command.build_ext import build_ext as build_ext_orig
15+
class build_ext(build_ext_orig):
16+
def run(self):
17+
pass
18+
19+
setup(name='tesseract-robotics',
1120
version='@tesseract_python_version@',
1221
description='Tesseract Python Library',
1322
author='John Wason',
1423
author_email='[email protected]',
1524
url='http://robotraconteur.com/',
1625
packages=find_packages(include=['tesseract_robotics','tesseract_robotics.*']),
17-
package_data={'': ['*.pyd', '*.so']},
26+
package_data={'': ['*.pyd', '*.so', '*.dll']},
1827
distclass=BinaryDistribution,
1928
license='Apache-2.0',
2029
install_requires=['numpy'],
21-
long_description='Tesseract package for Python'
30+
long_description='Tesseract Robotics package for Python',
31+
ext_modules=[
32+
Extension(
33+
name='tesseract_robotics.tesseract_common._tesseract_common',
34+
sources=[]
35+
),
36+
Extension(
37+
name='tesseract_robotics.tesseract_collision._tesseract_collision',
38+
sources=[]
39+
),
40+
Extension(
41+
name='tesseract_robotics.tesseract_command_language._tesseract_command_language',
42+
sources=[]
43+
),
44+
Extension(
45+
name='tesseract_robotics.tesseract_environment._tesseract_environment',
46+
sources=[]
47+
),
48+
Extension(
49+
name='tesseract_robotics.tesseract_geometry._tesseract_geometry',
50+
sources=[]
51+
),
52+
Extension(
53+
name='tesseract_robotics.tesseract_kinematics._tesseract_kinematics',
54+
sources=[]
55+
),
56+
Extension(
57+
name='tesseract_robotics.tesseract_motion_planners._tesseract_motion_planners',
58+
sources=[]
59+
),
60+
Extension(
61+
name='tesseract_robotics.tesseract_motion_planners_descartes._tesseract_motion_planners_descartes',
62+
sources=[]
63+
),
64+
Extension(
65+
name='tesseract_robotics.tesseract_motion_planners_ompl._tesseract_motion_planners_ompl',
66+
sources=[]
67+
),
68+
Extension(
69+
name='tesseract_robotics.tesseract_motion_planners_simple._tesseract_motion_planners_simple',
70+
sources=[]
71+
),
72+
Extension(
73+
name='tesseract_robotics.tesseract_process_managers._tesseract_process_managers',
74+
sources=[]
75+
),
76+
Extension(
77+
name='tesseract_robotics.tesseract_scene_graph._tesseract_scene_graph',
78+
sources=[]
79+
),
80+
Extension(
81+
name='tesseract_robotics.tesseract_srdf._tesseract_srdf',
82+
sources=[]
83+
),
84+
Extension(
85+
name='tesseract_robotics.tesseract_state_solver._tesseract_state_solver',
86+
sources=[]
87+
),
88+
Extension(
89+
name='tesseract_robotics.tesseract_time_parameterization._tesseract_time_parameterization',
90+
sources=[]
91+
),
92+
Extension(
93+
name='tesseract_robotics.tesseract_urdf._tesseract_urdf',
94+
sources=[]
95+
),
96+
Extension(
97+
name='tesseract_robotics.tesseract_visualization._tesseract_visualization',
98+
sources=[]
99+
)
100+
101+
],
102+
cmdclass={'build_ext': build_ext}
22103
)

tesseract_python/cmake/tesseract_python_module.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ function(tesseract_python_module PY_MOD_NAME )
1515

1616
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/python/tesseract_robotics/${PY_MOD_PACKAGE})
1717
set(SWIG_OUTFILE_DIR ${CMAKE_CURRENT_BINARY_DIR})
18-
19-
swig_add_module(${PY_MOD_NAME} python ${PY_MOD_SWIG_SRCS})
18+
if(${CMAKE_VERSION} VERSION_GREATER "3.8.0" OR ${CMAKE_VERSION} VERSION_EQUAL "3.8.0")
19+
swig_add_library(${PY_MOD_NAME} TYPE MODULE LANGUAGE python SOURCES ${PY_MOD_SWIG_SRCS})
20+
else()
21+
swig_add_module(${PY_MOD_NAME} python ${PY_MOD_SWIG_SRCS})
22+
endif()
2023
swig_link_libraries(${PY_MOD_NAME} ${PY_MOD_LIBS} jsoncpp_lib ${TinyXML2_LIBRARIES} ${EIGEN3_LIBRARIES} ${PYTHON_LIBRARIES})
2124

2225
set(PY_MOD_REAL_NAME1 SWIG_MODULE_${PY_MOD_NAME}_REAL_NAME)

0 commit comments

Comments
 (0)