-
-
If another package specifies the same command as rbtools, we'll have a repeat in this list. Think we need to bother de-duplicating?
-
Maybe we should default to commands provided by the rbtools package. So, if rbtools specifies the entry point, we use that as the command, and only check other packages if it doesn't. Something like:
ep = (pkg_resources.get_entry_info("rbtools", "rbtools_commands", args[0]) || pkg_resources.iter_entry_points("rbtools_commands", args[0]).next())
Allow third-party packages to register new rbt commands.
Review Request #5046 — Created Dec. 3, 2013 and submitted
Allow third-party packages to register new rbt commands.
rbt will now scan for commands that are registered for
the 'rbtools_commands' entrypoint.
Created a simple Python package that registered a new command, and sure enough, it showed up in rbt help, and could be invoked via rbt [command].
I created a third-party commands that tried to override the built-in "post" command, and tested to make sure that only one "post" command was listed with rbt help, and that only the built-in post command could be invoked.
Description | From | Last Updated |
---|---|---|
Maybe we should default to commands provided by the rbtools package. So, if rbtools specifies the entry point, we use … |
SM smacleod | |
The {.. for ...} is only in Python 2.7+. It'll need to be rewritten to work with 2.4+. |
|
|
This will end up getting the RBTools ones twice. We should probably filter that out. |
|
- Change Summary:
-
Good call, smacleod. I've modified the patch to de-dupe command names, and to try to use the RBTools built-in commands before checking for third-party commands.
- Diff:
-
Revision 2 (+9 -3)
- Change Summary:
-
Thanks for the feedback! I just cast to a set and back to a list to dedupe the commands instead of a set comprehension. Seems to do the job.
- Testing Done:
-
Created a simple Python package that registered a new command, and sure enough, it showed up in rbt help, and could be invoked via rbt [command].
~ Not sure if further testing is required / desired...
~ I created a third-party commands that tried to override the built-in "post" command, and tested to make sure that only one "post" command was listed with rbt help, and that only the built-in post command could be invoked.
- Diff:
-
Revision 3 (+10 -3)