sunpy/sunpy — pull request #639 by ayshih (2013-10-31 17:50:30+00:00)
Title: Version information for development installations

As noted in the past (#526, #503), it is desirable to be able to ask an end user to determine in a simple manner what version of SunPy they are running, specifically in the case where they are not running a straight release. This PR generates a not-tracked-by-git file `version.py` on any execution of `setup.py` (e.g., installations and upgrades) with the following content:
```
# This file is automatically generated by SunPy's setup.py
version = '0.3.1'
git_description = 'v0.3.1-128-ga4a1987'
```
`git_description` is the output of `git describe --tags`. In this example, the descriptions says that the current commit is 128 commits ahead of the nearest tag, `v0.3.1`, and the SHA1 hash for the commit starts with `a4a1987`.

To see this information in Python, it is printed by `sunpy.util.system_info()`, or you can grab it directly:
```
>>> import sunpy
>>> sunpy.version.git_description
'v0.3.1-128-ga4a1987'
```

This implementation is heavily inspired by the approach taken by NumPy, although they use only the SHA1 hash (from `git rev-parse HEAD`).

Notes:
* `git_description` will contain an error message if the process that executes `setup.py` cannot run/find git
* `git_description` will be 'N/A' if there is no `.git` directory, and then `system.util.system_info()` will know to ignore it