Skip to content

Install python programs properly #374

@ivanpauno

Description

@ivanpauno

Bug report

Required Info:

  • Operating System:
    • Windows 10
  • Installation type:
    • from source
  • Version or commit hash:
  • DDS implementation:
    • Any
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

The following launch file:

import launch
from launch_ros.actions import Node

def generate_launch_description():
    """Generate launch description with multiple components."""
    return launch.LaunchDescription([
        Node(
            package='action_tutorials',
            node_executable='fibonacci_action_server.py',
        )
    ])

Expected behavior

The fibonacci action server should be launched.

Actual behavior

The node crashes when launching the Node executable, because the installed file is not a proper program on Windows.

Additional information

I don't know if we have some cmake sugar for correctly installing python executables in an ament_cmake package.

In ament_python packages, we are using console_scripts entry_points, which work properly:

entry_points={
'console_scripts': [
'listener = demo_nodes_py.topics.listener:main',
'talker = demo_nodes_py.topics.talker:main',
'listener_qos = demo_nodes_py.topics.listener_qos:main',
'talker_qos = demo_nodes_py.topics.talker_qos:main',
'listener_serialized = demo_nodes_py.topics.listener_serialized:main',
'add_two_ints_client = demo_nodes_py.services.add_two_ints_client:main',
'add_two_ints_client_async = demo_nodes_py.services.add_two_ints_client_async:main',
'add_two_ints_server = demo_nodes_py.services.add_two_ints_server:main'
],
},

But in ament_cmake packages, the usual install macro doesn't produce the expected result:
install(
PROGRAMS
bin/fibonacci_action_client.py
bin/fibonacci_action_server.py
DESTINATION lib/${PROJECT_NAME}
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions