Best practice for making a project aware of its own branch name and revision number

Charles Duffy cduffy at spamcop.net
Thu Sep 21 02:29:57 BST 2006


So -- I have a piece of software which is revision controlled in bzr. I 
want to be able to include a branch name and build number in the 
--version output from this tool -- how can I best do that?

Having a script which runs as part of setup.py (and at startup when 
running out of the source tree) which creates a module (something like 
version.py) containing the relevant variables (such that this module and 
its contents can be imported if available) probably seems most 
reasonable. Obviously, error handling will need to be available for the 
case when the module isn't available or the script is running but bzr 
isn't installed, but that's trivial enough.

...but if there's a better approach that I'm missing, I'm not about to 
turn away any suggestions.





More information about the bazaar mailing list