astropy/astropy — pull request #140 by iguananaut (2012-01-31 22:58:14+00:00)
Title: Record compiler used in version.py

This patch depends on the pull request in #139.

While working on #139 I thought it might be useful, for diagnostic purposes if nothing else, to record the compiler that was used to build extension modules. For example, if a user is having some odd problem with an extension module we could ask them to give us astropy.version.compiler.

There are a couple things lacking in this current implementation:

1) This is only based on the `--compiler` option to setup.py. This is not useless, but it may mean different actual compilers on different platforms. It would be more useful if we also included the compiler version. Unfortunately there's no one guaranteed way to get this. Some variant of `CC --version` should work most of the time, but can't be counted on. Perhaps we could *try* something obvious like that, and if it fails then just go with "Unknown version" or some such.

2) This will include a 'compiler' value in version.py even when making a source distribution--a context in which it's mostly meaningless. This is mostly harmless, since when the user builds from source the version.py will be rewritten with the correct compiler. But I might consider amending this to somehow leave compiler out of version.py when running the `sdist` command.