title: Embed git hash into python file when installing
body: <p>I want to embed the git hash into the version number of a python module if that module is installed from the git repository using <code>./setup.py install</code>. How do I do that? </p>
  
  <p>My thought was to define a function in <code>setup.py</code> to insert the hash and arrange to have it called when setup has copied the module to its <code>build/lib/</code> directory, but before it has installed it to its final destination. Is there any way to hook into the build process at that point? </p>
  
  <p><strong>Edit</strong>: I know how to get the hash of the current version from the command line, I am asking about how to get such a command to run at the right time during the build/install. </p>