ros2cli icon indicating copy to clipboard operation
ros2cli copied to clipboard

Ament Python setup.cfg File Incorrectly Generated

Open 808brick opened this issue 3 years ago • 1 comments

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • ROS Foxy Binary
  • DDS implementation:
    • Default
  • Client library (if applicable):
    • N/A

Steps to reproduce issue

  • Create a new ament-python package
  • Add your script files to package python directory
  • Add scripts to setup.py file
  • Run colcon build
  • Source Package
  • Try to run script with ros2 run command
  • Receive an error saying executable not found

Expected behavior

Scripts run as expected

Actual behavior

Receive an error saying executable not found

Additional information

In terminal when creating a package using ament_python configuration, the setup.cfg files that get autogenerated appear to use "-" instead of "_" to separate the words for the directory variables, which ends up causing all ros2 run commands on scripts in that package to fail with an error "No executable found". (Terminal and directory picture at bottom)

It seems when the command is run, the setup.cfg file is created like so:

[develop]
script-dir=$base/lib/hello-world-python
[install]
install-scripts=$base/lib/hello-world-python

When it should be :

[develop]
script_dir=$base/lib/hello-world-python
[install]
install_scripts=$base/lib/hello-world-python

Where the difference is a underscore vs the hyphen. (Should be script_dir vs the autogenerated script-dir)

So I believe there is an error wherever the default setup.cfg file gets configured. This did not use to be an issue, so I think something may have happened in a relatively recent push.

This may be related to issues such as https://github.com/ros2/ros2cli/issues/715

Photo of error image

808brick avatar Jun 27 '22 18:06 808brick

In terminal when creating a package using ament_python configuration, the setup.cfg files that get autogenerated appear to use "-" instead of "_" to separate the words for the directory variables, which ends up causing all ros2 run commands on scripts in that package to fail with an error "No executable found". (Terminal and directory picture at bottom)

That should not be the case; both - and _ are valid (though in later versions of setup tools, _ is preferred). Up until Humble, we always use the -, so that is not likely the cause of the problem.

Please provide a full working example with your problem. Likely the issue lies somewhere else. Thanks.

clalancette avatar Jun 27 '22 19:06 clalancette