Skip to content

Commit f3a5618

Browse files
committed
Use rospy and setup.py to manage shebangs for Python 2 and Python 3
Following guidance found here: http://wiki.ros.org/UsingPython3/SourceCodeChanges#Changing_shebangs
1 parent 7bb50c5 commit f3a5618

File tree

7 files changed

+37
-9
lines changed

7 files changed

+37
-9
lines changed

CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(CMAKE_BUILD_TYPE "RELEASE")
1212

1313
find_package(catkin REQUIRED COMPONENTS
1414
roscpp
15+
rospy
1516
pcl_ros
1617
geodesy
1718
nmea_msgs
@@ -21,6 +22,7 @@ find_package(catkin REQUIRED COMPONENTS
2122
ndt_omp
2223
fast_gicp
2324
)
25+
catkin_python_setup()
2426

2527
find_package(PCL REQUIRED)
2628
include_directories(${PCL_INCLUDE_DIRS})
@@ -124,3 +126,10 @@ target_link_libraries(hdl_graph_slam_nodelet
124126
)
125127
add_dependencies(hdl_graph_slam_nodelet ${PROJECT_NAME}_gencpp)
126128

129+
catkin_install_python(
130+
PROGRAMS
131+
src/${PROJECT_NAME}/bag_player.py
132+
src/${PROJECT_NAME}/ford2bag.py
133+
src/${PROJECT_NAME}/map2odom_publisher.py
134+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
135+
)

package.xml

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<package>
2+
<package format="3">
33
<name>hdl_graph_slam</name>
44
<version>0.0.0</version>
55
<description>The hdl_graph_slam package</description>
@@ -13,21 +13,28 @@
1313
<build_depend>fast_gicp</build_depend>
1414
<build_depend>pcl_ros</build_depend>
1515
<build_depend>roscpp</build_depend>
16+
<build_depend>rospy</build_depend>
1617
<build_depend>nodelet</build_depend>
1718
<build_depend>geodesy</build_depend>
1819
<build_depend>nmea_msgs</build_depend>
1920
<build_depend>sensor_msgs</build_depend>
2021
<build_depend>message_generation</build_depend>
2122
<build_depend>libg2o</build_depend>
2223

23-
<run_depend>ndt_omp</run_depend>
24-
<run_depend>fast_gicp</run_depend>
25-
<run_depend>pcl_ros</run_depend>
26-
<run_depend>roscpp</run_depend>
27-
<run_depend>geodesy</run_depend>
28-
<run_depend>nodelet</run_depend>
29-
<run_depend>nmea_msgs</run_depend>
30-
<run_depend>sensor_msgs</run_depend>
24+
<exec_depend>ndt_omp</exec_depend>
25+
<exec_depend>fast_gicp</exec_depend>
26+
<exec_depend>pcl_ros</exec_depend>
27+
<exec_depend>roscpp</exec_depend>
28+
<exec_depend>rospy</exec_depend>
29+
<exec_depend>geodesy</exec_depend>
30+
<exec_depend>nodelet</exec_depend>
31+
<exec_depend>nmea_msgs</exec_depend>
32+
<exec_depend>sensor_msgs</exec_depend>
33+
34+
<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-scipy</exec_depend>
35+
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-scipy</exec_depend>
36+
<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-progressbar</exec_depend>
37+
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-progressbar</exec_depend>
3138

3239
<export>
3340
<nodelet plugin="${prefix}/nodelet_plugins.xml" />

setup.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
2+
3+
from setuptools import setup
4+
from catkin_pkg.python_setup import generate_distutils_setup
5+
6+
# fetch values from package.xml
7+
setup_args = generate_distutils_setup(
8+
packages=['hdl_graph_slam'],
9+
package_dir={'': 'src'})
10+
11+
setup(**setup_args)
12+

src/hdl_graph_slam/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)