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 ./setup.py install
. How do I do that?
My thought was to define a function in setup.py
to insert the hash and arrange to have it called when setup has copied the module to its build/lib/
directory, but before it has installed it to its final destination. Is there any way to hook into the build process at that point?
Edit: 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.