Skip to content

update ros_package_path.bat.em to follow logic in ros_package_path.sh.em#13

Merged
dirk-thomas merged 4 commits intoros:melodicfrom
kejxu:update_ros_package_path.bat
Jan 26, 2019
Merged

update ros_package_path.bat.em to follow logic in ros_package_path.sh.em#13
dirk-thomas merged 4 commits intoros:melodicfrom
kejxu:update_ros_package_path.bat

Conversation

@kejxu
Copy link
Copy Markdown

@kejxu kejxu commented Jan 15, 2019

the first part of this change is updating ros_package_path.bat.em to follow the same logic (reuse python code) in ros_package_path.sh.em.

the second part of this change does some extra package paths' processing by removing duplicate entries in the workspaces list

echo paths = [path for path in os.environ[env_name].split(os.pathsep)] if env_name in os.environ and os.environ[env_name] != '' else [] >> _parent_package_path.py
echo workspaces = [path for path in paths if os.path.exists(os.path.join(path, '.catkin'))] >> _parent_package_path.py
echo # remove duplicate entries >> _parent_package_path.py
echo unique_workspaces = [] >> _parent_package_path.py
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.

I would suggest to use a set here instead of a list since the order of elements doesn't matter and all items are unique.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! updated to use list(set()) + list comprehension to remove duplicate entries

@dirk-thomas
Copy link
Copy Markdown
Member

Thanks for the patch.

@dirk-thomas dirk-thomas added the enhancement New feature or request label Jan 26, 2019
@dirk-thomas dirk-thomas merged commit c1ee30e into ros:melodic Jan 26, 2019
@kejxu kejxu deleted the update_ros_package_path.bat branch January 28, 2019 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants