subversion revision number string within an application packaged with distutils?

J

Jim Tittsler

Is there a standard recipe for getting the subversion revision number
into my Python-based application each time I package it up with
distutils? (Not just the package name, but also a string that I will
display in my app's "About" dialog.)
 
G

Gabriel Genellina

Is there a standard recipe for getting the subversion revision number
into my Python-based application each time I package it up with
distutils? (Not just the package name, but also a string that I will
display in my app's "About" dialog.)

Under CVS, you use keywords like $Id$, $Author$, $Revision$ etc
inside your code, they get expanded like this:

__version__ = '$Revision: 1.8 $'[11:-2]

Subversion uses a similar mechanism but I'm not sure of the spelling.


--
Gabriel Genellina
Softlab SRL

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Jim said:
Is there a standard recipe for getting the subversion revision number
into my Python-based application each time I package it up with
distutils? (Not just the package name, but also a string that I will
display in my app's "About" dialog.)

You can't really use subversion's keyword substitution for that
(contrary to what Gabriel Genellina suggested): a $Revision$
field will only be updated to the revision in which the file
containing it changed. If you want the repository version at
the time of the packaging, you can use the svnversion tool.
On Windows, you can alternatively also use the subwcrev.exe
tool that comes with Tortoise.

If you don't want to invoke an external tool, you could also
retrieve the same information with the subversion Python
bindings.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top