Enforce that an option name isn't registered twice in a scope.

Review Request #3695 — Created April 15, 2016 and submitted

nhoward_tw, stuhood, wisechengyi

Amazingly, we didn't check for this before, at least not since we
got rid of our use of argparse.

This commit fixes the one case where we actually did double-register.
The fix required a bit of a hack in export.py, but there's a TODO for that,
and we need to revisit export.py anyway
(see https://github.com/pantsbuild/pants/issues/3200).

CI passes: https://travis-ci.org/pantsbuild/pants/builds/123318109

  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
  1. ping?

  2. NailgunClass does not seem to be an actual class, do you mean NailgunTaskBase?

    1. D'oh! I meant NailgunTask, thanks!

  2. src/python/pants/option/parser.py (Diff revision 2)

    Could this be a set intersection maybe?

    1. It could, but it would be less efficient, as args is almost always of cardinality 1, and very rarely of cardinality 2, never 3 or more (in practice). Also, if we use a set intersection then we have to pick a member of the intersection to use in the error message, and unless we use an OrderedSet that may not be the first member (which is the one the user will be most familiar with). It's more machinery than we need for this.

Review request changed

Status: Closed (submitted)

Change Summary: