Refactor setup.py, setup_helpers.py, and fix various little issues therein

This PR was initially motivated by #652. It also fixes #142 in such a way that supersedes my fix attached to that issue.  It does not directly address the issue in #651--the solution attached to that issue should probably be fine except for the need to change the names of the modules to ignore.

This possibly addresses other issues related to setup, but I haven't looked through the whole list.

This fix *could* have been simpler, but `setup.py` and `setup_helpers.py` were starting to turn into a big ball of mud, and it seemed necessary to make things better before they got worse.  It's still not perfect, but the new approach makes the `setup.py` a little easier to read, and is a bit more functional in nature with fewer interconnected parts and slightly easier to follow behavior, IMO.