Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ambiguous verb loading #33

Closed
rolling-robot opened this issue Feb 24, 2017 · 5 comments
Closed

ambiguous verb loading #33

rolling-robot opened this issue Feb 24, 2017 · 5 comments

Comments

@rolling-robot
Copy link

rolling-robot commented Feb 24, 2017

Hi,
I am implementing list_dependencies verb for ament.py and ran into the following:
$ ament.py list_dependencies -h
gives
optional arguments:
-h, --help show this help message and exit
--build Show build dependencies of a given package
while when I run
$ ament.py list_dependencies --build $anything code for another verb is loaded and gives help for build_pkg
usage: ament.py build_pkg [-h] [--build-space BUILD_SPACE]
....
The verb is added similar to list_packages verb, i.e. via a file in ament_tools/verbs
See https://github.com/rolling-robot/ament_tools/commit/a23d7c6e22b68d2eb702bd1f381cde63ac81be97

@mikaelarguedas
Copy link
Contributor

I tried to reproduce this locally but I got what I think is the expected behavior:

$ ament list_dependencies -h
usage: ament list_dependencies [-h] [--build-deps] [--exec-deps] [--test-deps]
                               [basepath] PACKAGE

List names and relative paths of dependencies of packages

positional arguments:
  basepath      Base paths to recursively crawl for packages
  PACKAGE       Package to process

optional arguments:
  -h, --help    show this help message and exit
  --build-deps  Show build dependencies of a given package
  --exec-deps   Show exec dependencies of a given package
  --test-deps   Show test dependencies of a given package

Could you give more context on your environment (OS, code version and environment setup: what commands did you run before this, what file you sourced etc) to help us reproduce this behavior?

Thanks!

@rolling-robot
Copy link
Author

Mikael, try this branch: https://github.com/rolling-robot/ament_tools/tree/buggy
-h option works fine in both cases
--build is the buggy one:

$ ./scripts/ament.py list_dependencies --build 234
usage: ament.py build_pkg [-h] [--build-space BUILD_SPACE]
                          [--install-space INSTALL_SPACE] [--build-tests]
                          [--make-flags [MAKE_FLAGS [MAKE_FLAGS ...]]]
                          [--skip-build] [--skip-install] [-s]
                          [path]
ament.py build_pkg: error: ambiguous option: --build could match --build-space, --build-tests

I am using fresh installation of ubuntu16.04 on a virtual machine.

$ uname -a
Linux ros2 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ python3 --version
Python 3.5.2

@mikaelarguedas
Copy link
Contributor

mikaelarguedas commented Feb 24, 2017

Ok I see, one would expect --build to be resolved as --build-deps but it falls back to parser help of the last verb of the list.
But if you pass --build-deps it works as expected right ?

Anyway valid issue thanks for reporting it.

@rolling-robot
Copy link
Author

rolling-robot commented Feb 24, 2017

But if you pass --build-deps it works as expected right?

Right. That's why I named the option build-deps which is tautology. The user have already stated that he wants the dependencies by list-dependencies

@rolling-robot
Copy link
Author

@mikaelarguedas, it seems that this problem is the artefact of the way ament build_pkg loads arguments, not osrf_pycommon.

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

No branches or pull requests

2 participants