Skip to content

add env vars ROS_PACKAGE_PATH and ROS_ETC_DIR#2

Merged
dirk-thomas merged 3 commits intomasterfrom
ros_package_path_and_ros_etc_dir
Jan 26, 2018
Merged

add env vars ROS_PACKAGE_PATH and ROS_ETC_DIR#2
dirk-thomas merged 3 commits intomasterfrom
ros_package_path_and_ros_etc_dir

Conversation

@dirk-thomas
Copy link
Copy Markdown
Member

After it has been reviewed and merged I will:

  • create ROS 1 distro specific branches and replace the TODOs with 1 and melodic / lunar / kinetic

@dirk-thomas
Copy link
Copy Markdown
Member Author

The second commit aligns the code with the ROS 2 specific PR #3.

@mikaelarguedas
Copy link
Copy Markdown
Member

After it has been reviewed and merged I will [...]

So the goal is that master will be for ROS 1 but ROS_DISTRO agnostic, right?
Or do you plan on removing the master branch once ROS 1 branches have been created?

@@ -0,0 +1,26 @@
# generated from ros_environment/env-hooks/1.ros_package_path.sh.em
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file in roslib has these lines as well, but I don't see them here. Is the omission intended?

# scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
export PATH="`@(PYTHON_EXECUTABLE) -c \"import os; print(os.pathsep.join([x for x in \\\"$PATH\\\".split(os.pathsep) if not any([d for d in ['cturtle', 'diamondback', 'electric', 'fuerte'] if d in x])]))\"`"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are so old distros that I removed them intentionally. None of these legacy ROS distros shares a common platform so I don't expect that they are installed on any current system using current ROS distros.

@dirk-thomas
Copy link
Copy Markdown
Member Author

So the goal is that master will be for ROS 1 but ROS_DISTRO agnostic, right?
Or do you plan on removing the master branch once ROS 1 branches have been created?

Master will be removed and there will only be ROS distro specific branches.

# ROS_DISTRO value for a workspace, for example to deliberately use a newer version of roslib with
# an older release or vice-versa, or to define a custom distro (eg, "ROS Banana").
from os import environ
ROS_DISTRO = environ.get("ROS_DISTRO_OVERRIDE", "TODO")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was ROS_DISTRO_OVERRIDE used for in ROS 1?

Copy link
Copy Markdown
Member Author

@dirk-thomas dirk-thomas Jan 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example to deliberately use a newer version of roslib with an older release or vice-versa

Since the environment hooks are not bundled with roslib anymore this use case won't exist anymore.

or to define a custom distro

I added 479033e to keep supporting this corner case.

set ROS_PACKAGE_PATH=@(CMAKE_SOURCE_DIR)!ROS_PACKAGE_PATH_PARENTS!
@[else]@
REM env variable in installspace
set ROS_PACKAGE_PATH=@(CMAKE_INSTALL_PREFIX)/share;@(CMAKE_INSTALL_PREFIX)/stacks;%ROS_PACKAGE_PATH_PARENTS%
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sh version checks that the "stacks" folder exists before adding it but the bat version doesnt, is it on purpose ?

Copy link
Copy Markdown
Member Author

@dirk-thomas dirk-thomas Jan 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the existing logic from roslib which I didn't want to change.

export ROS_ETC_DIR="@(CATKIN_DEVEL_PREFIX)/@(CATKIN_GLOBAL_ETC_DESTINATION)/ros"
@[else]@
# env variable in installspace
if [ -z "$CATKIN_ENV_HOOK_WORKSPACE" ]; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the use of CATKIN_ENV_HOOK_WORKSPACE not supported in the windows case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current logic from roslib.

@mikaelarguedas
Copy link
Copy Markdown
Member

mikaelarguedas commented Jan 26, 2018

lgtm except the differences in behavior pointed out above. If you think it's not worth homogenizing feel free to merge as is 👍

Copy link
Copy Markdown
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for reproducing the current behavior, pending the ROS_DISTRO specific branches.

The only change is dropping the older platform cleaning logic which I think is now far enough out of date to be fine.

@dirk-thomas dirk-thomas force-pushed the ros_package_path_and_ros_etc_dir branch from cafb3c3 to 8395357 Compare January 26, 2018 17:46
@dirk-thomas dirk-thomas merged commit b826d4b into master Jan 26, 2018
@dirk-thomas dirk-thomas deleted the ros_package_path_and_ros_etc_dir branch January 26, 2018 17:46
@dirk-thomas
Copy link
Copy Markdown
Member Author

johnsonshih added a commit to johnsonshih/ros_environment that referenced this pull request Oct 4, 2018
* Get ROS_PACKAGE_PATH from the python

* normcase workspace path and eliminate duplicate entries
dirk-thomas pushed a commit that referenced this pull request Jan 26, 2019
….em (#13)

* Update env. hook batch file to set ros_package_path correctly (#1)

* Get ROS_PACKAGE_PATH from the python  (#2)

* Get ROS_PACKAGE_PATH from the python

* normcase workspace path and eliminate duplicate entries

* Preserve the content from CMAKE_PREFIX_PATH and remove duplicate entries (#4)

* use set to remove duplicate entries in a list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants