Fix Python 3 incompatibilities with the rbt command name and pagination.

Review Request #10313 — Created Nov. 8, 2018 and updated


This fixes two issues that came up involving RBTools running on newer
versions of Python 3.

The first has to do with the RB_MAIN constant for rbt, which an
older change from 2016 set as a byte string in order to avoid string
type issues and logging with Unicode characters. While important then,
we actually want it as a Unicode string now, as the areas that were
sensitive to this now normalize string types for the proper platform.
Keeping it as a byte string actually broke functionality, like custom
rbt-<scriptname> commands, aliases, and bits of help output.

The other issue has to do with pagination. StopIteration is
deprecated, and handled differently on Python 3.7. This resulted in
breakages with ListResource.all_pages, which was crashing with this
exception rather than simply stopping iteration. While in time it'd be
better to phase out StopIteration, we for now catch it where we care
about it and handle it the way we'd expect. This fixes rbt status, and
other commands.

Tested rbt --help, rbt --debug, rbt post --description="<unicode>",
rbt status, custom aliases, and custom rbt-* scripts on Python 2.7
and 3.7. All commands worked as expected, with and without Unicode

Checks run (2 succeeded)
flake8 passed.
JSHint passed.
  1. Ship It!