Best practice for making a project aware of its own branch name and revision number
Michael Ellerman
michael at ellerman.id.au
Thu Sep 21 04:46:30 BST 2006
On 9/21/06, Charles Duffy <cduffy at spamcop.net> wrote:
> 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.
I never got around to it, but when someone asked for CVS style
$Keyword$ $Expansion$, it occured to me that a much cleaner way to do
it would be to have an export-hook that did that. So as part of your
build script you do an export with keyword expansion, which can fill
in the version etc.
cheers
More information about the bazaar
mailing list