Versioning changes

This pull request reuses some code from django for generating a version number from a tuple. It also pulls in some code for generating ``.dev`` version numbers from that last git commit date.