astropy/astropy — pull request #3085 by embray (2014-11-07 18:53:54+00:00)
Title: Auto-build extension modules when importing astropy from source checkout

This is a somewhat minor enhancement developer convenience, but something that affects me frequently.
If either importing astropy when your CWD is in the Astropy source checkout, or when using `./setup.py develop`, there was already an error message displayed if the C extension modules need to be built.

But this necessitated exiting the Python interpreter (or at least opening a separate terminal) and manually running `./setup.py build_ext --inplace` in order to make it work. This now just does that automatically without ever having to leave the Python prompt.

The one shortcoming I see, which is not unique to this PR is that the heuristic used is just that the `utils._compiler` module can't be imported. Ideally we'd check for any extension modules that need to be rebuilt, but that's a little trickier without some explicit list of extension modules somewhere. I think that can be addressed as a separate issue though.