ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How can I use other python package in releasing environment

asked 2013-10-02 07:21:15 -0600

updated 2013-10-18 21:39:00 -0600

I want to run a script that uses already release python package (genrb) from cmake. Though in normal catkin environment it has no problem, when releasing as debian package it fails.

I write below in CMakeLists and this works fine in normal catkin environment.(this is a part of macro)

add_custom_target(rosruby_genmsg_for_${PROJECT_NAME} ALL COMMAND ${ROSRUBY_GENMSG_DIR}/rosruby_genmsg.py ${ARGN} -d ${ROSRUBY_DEVEL_LIB_DESTINATION} )

in rosruby_genmsg.py, it imports genrb package like

from genrb.generator import msg_generator

and that line fails in relese jenkins environment. the result is here.

(also local prerelease test fails)

How can we do like this?

  • use python package that is already released
    • in releasing environment
    • from cmake macro
    • the package (genrb) is in package.xml (build_depend and run_depend)
    • I'm using bloom to release

This is the code that I want to release.

https://github.com/OTL/rosruby/tree/0.5.1

EDIT1:

${CATKIN_ENV} did not solve my problem. Prerelease test failed in my local environment.

CATKIN_ENV (that means catkin_generated/env_cached.sh -> setup_cached.sh) adds PYTHONPATH like below.

export PYTHONPATH="/tmp/tmp0r5SRD/obj-x86_64-linux-gnu/devel/lib/python2.7/dist-packages:$PYTHONPATH"

but python libraries installed by binary is not there. that is place for source installed libraries. We need /opt/ros/hydro/lib/python2.7/dist-packages in order to use binary(debian) installed ros python library. Is this correct?

I used below cmake script. This fails in local prerelease test.

COMMAND ${CATKIN_ENV} ${PYTHON_EXECUTABLE} ${ROSRUBY_GENMSG_DIR}/rosruby_genmsg.py ${ARGN} -d ${ROSRUBY_DEVEL_LIB_DESTINATION}

https://github.com/OTL/rosruby/blob/master/cmake/rosruby-macro.cmake#L20

EDIT2:

This does not happened in build farm prerelease test. Is it a problem of my local test?

edit retag flag offensive close merge delete

Comments

It seems that binary install environment does not support ROS environmental variables. So if we want to use it, we have to source /opt/ros/hydro/setup.sh in shell script, then call the python script.

ogutti gravatar image ogutti  ( 2013-10-04 18:49:17 -0600 )edit

Before invoking CMake you have to make sure that all system stuff you want to use is in the environment. The env script will only take care of the catkin specific environment extension.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-10-09 07:34:04 -0600 )edit

Local pre-release test failed, but build farm test seems success! It seems better to use prerelease site. (I always used local prerelease test) http://prerelease.ros.org/create_job/hydro Anyway, thank you very much for your support.

ogutti gravatar image ogutti  ( 2013-10-18 21:37:17 -0600 )edit

The wiki for local pre-release has just recently been edited as to recommend the one on buildfarm http://wiki.ros.org/bloom/Tutorials/PrereleaseTest#Locally (triggered by this discussion http://lists.ros.org/pipermail/ros-release/2013-October/004282.html)

130s gravatar image 130s  ( 2013-10-19 05:35:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-10-05 08:25:38 -0600

Dirk Thomas gravatar image

In order to use the correct environment during the build process you need to prefix your command with the ${CATKIN_ENV} variable. It uses the generated env.sh script which will source the setup.sh file before calling the command passed in as an argument.

There is a short description about that in the catkin docs: http://docs.ros.org/api/catkin/html/user_guide/environment.html

You can also take a look at some code which makes use of that to invoke external commands: https://github.com/ros/catkin/blob/eeca8c4aa722666138ab9eced7bacb95e84f7f67/cmake/catkin_python_setup.cmake#L61

edit flag offensive delete link more

Comments

Thanks! That is what i'm searching!

ogutti gravatar image ogutti  ( 2013-10-08 05:32:33 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-10-02 07:21:15 -0600

Seen: 331 times

Last updated: Oct 18 '13