Use astropy template for setup.py etc.

Right now, the setup.py script is a hacked copy of one I wrote for one of my own packages years ago - it kinda sucks.

This is an attempt to merge in the astropy template, which should allow nice features like `python setup.py test`.

However, I definitely made some mistakes in the merge.  @astrofrog - if you can guide me along, maybe I can start doing some of the template merges on other packages too.