colcon / colcon-ros

Extension for colcon to support ROS packages
http://colcon.readthedocs.io
Apache License 2.0
13 stars 26 forks source link

Ensure data_files is not None. #99

Closed nuclearsandwich closed 4 years ago

nuclearsandwich commented 4 years ago

The implementation of setup_py_data includes a key for 'data_files' with a value of None if the attribute is not specified. As a result, setup_py_data.get('data_files', []) can return None if no data_files are specified.

When data_files is none it actually triggers a failure in colcon-core's get_data_files_mapping function:

Traceback (most recent call last):
  File
  "/home/jenkins-agent/workspace/ci_linux/venv/lib/python3.6/site-packages/colcon_core/executor/__init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File
   "/home/jenkins-agent/workspace/ci_linux/venv/lib/python3.6/site-packages/colcon_core/task/__init__.py", line 92, in __call__
    return await task_method(*args, **kwargs)
  File
   "/home/jenkins-agent/workspace/ci_linux/venv/lib/python3.6/site-packages/colcon_ros/task/ament_python/build.py", line 55, in build
    setup_py_data.get('data_files', []))
  File
   "/home/jenkins-agent/workspace/ci_linux/venv/lib/python3.6/site-packages/colcon_core/task/python/__init__.py", line 34, in get_data_files_mapping
    for data_file in data_files:
TypeError: 'NoneType' object is not iterable

An additional PR may be desired there to defensibly check for None before iterating but I figured I'd start here.

dirk-thomas commented 4 years ago

Please provide steps to reproduce the problem.

nuclearsandwich commented 4 years ago

Please provide steps to reproduce the problem.

Build test_launch_ros in Dashing. e.g. https://ci.ros2.org/job/ci_linux/9552/

dirk-thomas commented 4 years ago

This regression was introduce in #97.

dirk-thomas commented 4 years ago

Build test_launch_ros in Dashing. e.g. https://ci.ros2.org/job/ci_linux/9552/

Rebuild using this branch: Build Status

nuclearsandwich commented 4 years ago

Thanks for the quick release! :love_letter: