Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions launch_ros/launch_ros/substitutions/find_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
from launch.launch_context import LaunchContext
from launch.some_substitutions_type import SomeSubstitutionsType
from launch.substitution import Substitution
from launch.substitutions import PathSubstitution
from launch.utilities import normalize_to_list_of_substitutions
from launch.utilities import perform_substitutions


class FindPackage(Substitution):
class FindPackage(PathSubstitution):
"""
Abstract base class for substitutions involving finding a package.

Expand All @@ -41,7 +42,7 @@ def __init__(
package: SomeSubstitutionsType,
) -> None:
"""Create a FindPackage substitution."""
super().__init__()
super().__init__(self)
self.__package = normalize_to_list_of_substitutions(package)

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ def test_find_package_share():
package_prefix = Path(sub.perform(context))
package_xml_file = package_prefix / Path('package.xml')
assert package_xml_file.is_file()


def test_find_package_paths():
sub = FindPackageShare('launch_ros') / 'package.xml'
context = LaunchContext()
result_path = sub.perform(context)
assert Path(result_path).is_file()