From fb24554d4519b3d090a5bdfefbbbf0db41c5822c Mon Sep 17 00:00:00 2001 From: iory Date: Fri, 1 Jul 2022 03:41:29 +0900 Subject: [PATCH] [jsk_rosbag_tools] Enable catkin_virtualenv for pip dependencies --- jsk_rosbag_tools/.gitignore | 1 + jsk_rosbag_tools/CMakeLists.txt | 31 +++++++++++++++++-- jsk_rosbag_tools/package.xml | 7 ++++- jsk_rosbag_tools/requirements.in | 1 + jsk_rosbag_tools/scripts/bag_to_audio.py | 0 jsk_rosbag_tools/scripts/bag_to_video.py | 0 jsk_rosbag_tools/scripts/compress_imgs.py | 0 jsk_rosbag_tools/scripts/merge.py | 0 jsk_rosbag_tools/scripts/tf_static_to_tf.py | 0 jsk_rosbag_tools/scripts/video_to_bag.py | 0 jsk_rosbag_tools/tests/test_bag_to_video.py | 0 .../tests/test_jsk_rosbag_tools.py | 0 12 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 jsk_rosbag_tools/requirements.in mode change 100755 => 100644 jsk_rosbag_tools/scripts/bag_to_audio.py mode change 100755 => 100644 jsk_rosbag_tools/scripts/bag_to_video.py mode change 100755 => 100644 jsk_rosbag_tools/scripts/compress_imgs.py mode change 100755 => 100644 jsk_rosbag_tools/scripts/merge.py mode change 100755 => 100644 jsk_rosbag_tools/scripts/tf_static_to_tf.py mode change 100755 => 100644 jsk_rosbag_tools/scripts/video_to_bag.py mode change 100755 => 100644 jsk_rosbag_tools/tests/test_bag_to_video.py mode change 100755 => 100644 jsk_rosbag_tools/tests/test_jsk_rosbag_tools.py diff --git a/jsk_rosbag_tools/.gitignore b/jsk_rosbag_tools/.gitignore index f935021a8..571491802 100644 --- a/jsk_rosbag_tools/.gitignore +++ b/jsk_rosbag_tools/.gitignore @@ -1 +1,2 @@ !.gitignore +requirements.txt diff --git a/jsk_rosbag_tools/CMakeLists.txt b/jsk_rosbag_tools/CMakeLists.txt index 686c46117..307da0895 100644 --- a/jsk_rosbag_tools/CMakeLists.txt +++ b/jsk_rosbag_tools/CMakeLists.txt @@ -3,14 +3,32 @@ project(jsk_rosbag_tools) find_package( catkin REQUIRED + catkin_virtualenv ) +if (${catkin_virtualenv_VERSION} VERSION_LESS "0.5.1") + message(STATUS "jsk_rosbag_tools requires catkin_virtualenv >= 0.5.1") + return() +endif() + + catkin_python_setup() catkin_package( CATKIN_DEPENDS ) +if($ENV{ROS_DISTRO} STREQUAL "noetic") + catkin_generate_virtualenv( + INPUT_REQUIREMENTS requirements.in + PYTHON_INTERPRETER python3 + ) +else() + catkin_generate_virtualenv( + INPUT_REQUIREMENTS requirements.in + ) +endif() + file(GLOB SCRIPTS_FILES scripts/*) catkin_install_python( PROGRAMS ${SCRIPTS_FILES} @@ -47,10 +65,19 @@ if(CATKIN_ENABLE_TESTING) DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) add_rostest(tests/test_jsk_rosbag_tools.test - DEPENDENCIES download_audio_data download_video_data) + DEPENDENCIES ${PROJECT_NAME}_generate_virtualenv download_audio_data download_video_data) if("$ENV{ROS_DISTRO}" STRGREATER "indigo") # could not install moviepy on indigo. add_rostest(tests/test_bag_to_video.test - DEPENDENCIES download_audio_data download_video_data) + DEPENDENCIES ${PROJECT_NAME}_generate_virtualenv download_audio_data download_video_data) endif() endif() + +install(DIRECTORY scripts samples + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + USE_SOURCE_PERMISSIONS +) + +install(FILES requirements.txt + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +) diff --git a/jsk_rosbag_tools/package.xml b/jsk_rosbag_tools/package.xml index 5a0dca4a7..87d3eef03 100644 --- a/jsk_rosbag_tools/package.xml +++ b/jsk_rosbag_tools/package.xml @@ -11,10 +11,11 @@ catkin python-catkin-pkg-modules + catkin_virtualenv + audio_common_msgs cv_bridge ffmpeg - python-moviepy-pip python-numpy python-rospkg-modules python-scipy @@ -34,4 +35,8 @@ roslint rostest + + requirements.txt + + diff --git a/jsk_rosbag_tools/requirements.in b/jsk_rosbag_tools/requirements.in new file mode 100644 index 000000000..f7b02cd95 --- /dev/null +++ b/jsk_rosbag_tools/requirements.in @@ -0,0 +1 @@ +moviepy==1.0.3 diff --git a/jsk_rosbag_tools/scripts/bag_to_audio.py b/jsk_rosbag_tools/scripts/bag_to_audio.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/scripts/bag_to_video.py b/jsk_rosbag_tools/scripts/bag_to_video.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/scripts/compress_imgs.py b/jsk_rosbag_tools/scripts/compress_imgs.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/scripts/merge.py b/jsk_rosbag_tools/scripts/merge.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/scripts/tf_static_to_tf.py b/jsk_rosbag_tools/scripts/tf_static_to_tf.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/scripts/video_to_bag.py b/jsk_rosbag_tools/scripts/video_to_bag.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/tests/test_bag_to_video.py b/jsk_rosbag_tools/tests/test_bag_to_video.py old mode 100755 new mode 100644 diff --git a/jsk_rosbag_tools/tests/test_jsk_rosbag_tools.py b/jsk_rosbag_tools/tests/test_jsk_rosbag_tools.py old mode 100755 new mode 100644