症状
めっちゃエラー出る。
$ colcon build --packages-select ros2_first_test
Starting >>> ros2_first_test
<string>:19: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/distutils/core.py", line 215, in run_setup
exec(f.read(), g)
File "<string>", line 19, in <module>
TypeError: 'tuple' object is not callable
--- stderr: ros2_first_test
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__
rc = await self.task(*args, **kwargs)
File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__
return await task_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build
setup_py_data = get_setup_data(self.context.pkg, env)
File "/usr/lib/python3/dist-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data
return dict(pkg.metadata[key](env))
File "/usr/lib/python3/dist-packages/colcon_ros/package_augmentation/ros_ament_python.py", line 57, in getter
return get_setup_information(
File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 249, in get_setup_information
_setup_information_cache[hashable_env] = _get_setup_information(
File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 296, in _get_setup_information
result = subprocess.run(
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1.
---
Failed <<< ros2_first_test [0.19s, exited with code 1]
Summary: 0 packages finished [0.36s]
1 package failed: ros2_first_test
1 package had stderr output: ros2_first_test
Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1.
ポイントは、
<string>:19: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
だった。
原因
setup.py での誤記。。。
間違い探しw
setup.py 抜粋
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
(os.path.join('share', package_name, 'launch'), glob('launch/*.py'))
(os.path.join('share', package_name, 'urdf'), glob('urdf/*.urdf'))
],
下記追加したけど、まさかのカンマ忘れ。
(os.path.join('share', package_name, 'launch'), glob('launch/*.py'))
(os.path.join('share', package_name, 'urdf'), glob('urdf/*.urdf'))
追加行コメントアウトしたら動くまでは確認していたけど、誤記を見落とし。。。
<string>:19: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
下記とか怪しいから、こっちを探してしまったのが運の尽き・・・
"with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet"