Skip to content

Add get_package_share_path method#73

Merged
audrow merged 2 commits intoament:masterfrom
DLu:pathlib
May 27, 2021
Merged

Add get_package_share_path method#73
audrow merged 2 commits intoament:masterfrom
DLu:pathlib

Conversation

@DLu
Copy link
Copy Markdown
Contributor

@DLu DLu commented May 5, 2021

Rather than all the ugliness of os.path.join I would much rather write simpler python in my launch files, so rather than

import os
from ament_index_python.packages import get_package_share_directory
...
bringup_dir = get_package_share_directory('testpkg')
urdf_path = os.path.join(bringup_dir, 'urdf', 'doggo.urdf')

you could just write

from ament_index_python.packages import get_package_share_path
...
urdf_path = get_package_share_path('testpkg') / 'urdf/doggo.urdf'

Signed-off-by: David V. Lu <davidvlu@gmail.com>
Copy link
Copy Markdown
Contributor

@audrow audrow left a comment

Choose a reason for hiding this comment

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

This looks like a good addition to me. Can you write a test for the new function and make the linter happy?

@audrow audrow self-assigned this May 7, 2021
@DLu DLu force-pushed the pathlib branch 2 times, most recently from ba8f309 to 1902978 Compare May 8, 2021 03:19
Signed-off-by: David V. Lu <davidvlu@gmail.com>
@DLu
Copy link
Copy Markdown
Contributor Author

DLu commented May 27, 2021

@audrow Linter is happy and now there's a test.

@audrow audrow self-requested a review May 27, 2021 16:07
Copy link
Copy Markdown
Contributor

@audrow audrow 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 to me, I'll run CI.

@audrow
Copy link
Copy Markdown
Contributor

audrow commented May 27, 2021

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@audrow audrow merged commit 028080c into ament:master May 27, 2021
@audrow
Copy link
Copy Markdown
Contributor

audrow commented May 27, 2021

Thanks for the PR @DLu!

@DLu DLu deleted the pathlib branch May 27, 2021 17:12
DLu added a commit to DLu/ament_index that referenced this pull request May 27, 2021
* Add get_package_share_path method

Signed-off-by: David V. Lu <davidvlu@gmail.com>

* PR Feedback

Signed-off-by: David V. Lu <davidvlu@gmail.com>
DLu added a commit to DLu/ament_index that referenced this pull request May 27, 2021
* Add get_package_share_path method

Signed-off-by: David V. Lu <davidvlu@gmail.com>

* PR Feedback

Signed-off-by: David V. Lu <davidvlu@gmail.com>
audrow pushed a commit that referenced this pull request May 27, 2021
* Add get_package_share_path method

Signed-off-by: David V. Lu <davidvlu@gmail.com>

* PR Feedback

Signed-off-by: David V. Lu <davidvlu@gmail.com>
audrow pushed a commit that referenced this pull request May 27, 2021
* Add get_package_share_path method

Signed-off-by: David V. Lu <davidvlu@gmail.com>

* PR Feedback

Signed-off-by: David V. Lu <davidvlu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants