Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Fix error when calling build_pkg on ament_cmake package #81

Closed
wants to merge 1 commit into from

Conversation

dhood
Copy link
Contributor

@dhood dhood commented Feb 27, 2016

Whenever I try to use the build_pkg or test_pkg verbs on ament_cmake packages instead of build/test, I get the following error:

$ ament build_pkg .

Process package 'pendulum_msgs' with context:
--------------------------------------------------------------------------------
 source_space => /Users/deanna/ros2_ws/src-master/ros2/demos/pendulum_msgs
  build_space => /Users/deanna/ros2_ws/src-master/ros2/demos/pendulum_msgs/build/pendulum_msgs
install_space => /Users/deanna/ros2_ws/src-master/ros2/demos/pendulum_msgs/install
   make_flags => None
  build_tests => False
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/bin/ament", line 9, in <module>
    load_entry_point('ament-tools==0.0.0', 'console_scripts', 'ament')()
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/commands/ament.py", line 88, in main
    rc = args.main(args)
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 270, in main
    context = get_context(opts)
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 276, in get_context
    return create_context(opts)
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 383, in create_context
    ce = build_type_impl.extend_context(opts)
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/build_types/ament_cmake.py", line 59, in extend_context
    ce = super(AmentCmakeBuildType, self).extend_context(options)
  File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/build_types/cmake.py", line 88, in extend_context
    force_cmake_configure = options.force_cmake_configure
AttributeError: 'Namespace' object has no attribute 'force_cmake_configure'

I think an appropriate fix is to call super().prepare_arguments in AmentCmakeBuildType, as was done in
a682b3d

However, since in the 'build' verb prepare_arguments is called for both AmentCmakeBuildType and CmakeBuildType, it's also necessary to use the 'resolve' conflict handler on the (sub)parser so it doesn't give an error when the arguments are added a second time.

I've just added the use of the resolve conflict handler for that specific parser, but if you think it's appropriate more globally, then I think this is where it would go: https://github.com/osrf/osrf_pycommon/blob/release-alpha3/osrf_pycommon/cli_utils/verb_pattern.py#L98

@dhood
Copy link
Contributor Author

dhood commented Feb 28, 2016

Hope to re-open this soon, have discovered some kinks.

@dhood dhood closed this Feb 28, 2016
@dirk-thomas
Copy link
Contributor

Just as feedback: I am a little bit worried about the conflict handler. The chance that it will hide actual problems in the future is pretty high.

@dhood
Copy link
Contributor Author

dhood commented Feb 29, 2016

thanks for that @dirk-thomas - it's a fair point. I have some ideas for alternatives, but I've opened #84 to get an idea of if this direction makes sense or not.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants