-
Notifications
You must be signed in to change notification settings - Fork 22
allow multiple package names for --only-packages #114
Conversation
Works fine locally, that's great! will save us quite some time |
Listing a single pkg name in Using |
Yeah I'm just surprised that I can run |
When you consider a future option |
Fair point, we should just explain it somewhere in a future "ament tutorial" so that people are not confused by it. |
576265a
to
e511428
Compare
After talking about the various case more I updated the patch to only output a warning if all selected packages are also being skipped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for iterating so quickly on it
Should we propagate the same changes to https://github.com/ament/ament_tools/blob/master/ament_tools/verbs/uninstall/cli.py#L64 for consistency in parameters among verbs ?
@@ -114,13 +114,13 @@ def prepare_arguments(parser, args): | |||
help='End with a particular package', | |||
) | |||
parser.add_argument( | |||
'--only-package', | |||
'--only', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep the --only
alias for convenience ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any shorter but unique variation of arguments is always available. That's also why renaming it from --only-package
to --only-packages
is backward compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but it won't be displayed in the help message anymore if it is removed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, but neither do many of the other arguments have that kind of alternative explicit shortcut. If more people want to keep it please feel free to readd it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be an extra option that we have to maintain auto-complete for so I'd support leaving it off the list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let's leave it out then
help='Only process a particular package, implies --start-with <pkg> and --end-with <pkg>' | ||
'--only-packages', | ||
nargs='*', default=[], | ||
help='Only process a particular set of packages' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'List of packages to process'
would be more consistent with the --skip-packages help (and makes it clear it's not a flag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the existing help string to use set
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that the whole phrase makes it sounds like a boolean flag to me. but the array "type" in the help output will make it clearer
e511428
to
abe5939
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The base path is listed as the last option in the help output. But if I use
--only-packages
I cannot put the base path as the last option.
dhood@osrf-esteve:~/ros2_ws [ros2_ws]$ ament build --only-packages rcl ./src
Package './src' specified with --only-package was not found.
.2. What is the expected behaviour of passing an empty list? I would have expected that no work is done, but instead the whole workspace is built.
.3. Tab autocomplete needs to be updated
@@ -114,13 +114,13 @@ def prepare_arguments(parser, args): | |||
help='End with a particular package', | |||
) | |||
parser.add_argument( | |||
'--only-package', | |||
'--only', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be an extra option that we have to maintain auto-complete for so I'd support leaving it off the list
|
||
if opts.only_package: | ||
nonexistent_skip_packages = set(opts.skip_packages) - set(package_names) | ||
if set(opts.skip_packages) - set(package_names): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use the nonexistent_skip_packages
variable here instead of recalculating it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
||
def consolidate_package_selection(opts, package_names): | ||
# after this function opts.skip_packages will contain the information from: | ||
# start_package, end_package, only_packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start_with, end_with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, documentation from a different tool which uses different argument names 😉 Updated.
abe5939
to
767f1e3
Compare
|
I am still finding the greedy behaviour a bit strange when combined with This works fine:
But this does not:
|
The |
I see your point about This was unexpected for me because of the difference in how other optionals such as To illustrate, here's a valid invocation for passing cmake args, only-packages, skip-packages and specifying the basepath:
You'll see that, while more optionals come after --cmake-args, we have to pass the delimiter with it, since we are parsing the delimiter with extract_argument_group, not argparse. This is why I figured you'd have to do the same for ending argument collection for I wouldn't have gotten into this case if |
e7ec15d
to
d0ae9d6
Compare
--only-packages
.start_with
,end_with
,only_packages
are merged intoskip_packages
).