[Tutor] CVS Version Number in __version__

Abel Daniel abli@freemail.hu
Wed Mar 5 14:05:05 2003


Sean Abrahams (sa@sfsu.edu) wrote:
> 
> How do I get CVS to automatically input the version of the file and
> the date into __version__ and __date__, respectively?
> 
What you need is called keyword substitution, see
http://www.cvshome.org/docs/manual/cvs_12.html

so you want something like
__version__='$Revision$'
__date__='$Date$'
in the file
When you do a cvs checkin, the $..$ will be substituted with the
appropiate data.

Of course for this, keyword expansion should be turned on. For normal
textfiles it is turned on by default, but you can turn it off when you
add the file to the repository (for data files, such expansion would
cause mayor breakage).

Also note the python style guide's recomendation:
(from http://python.org/peps/pep-0008.html)
"""
Version Bookkeeping

    If you have to have RCS or CVS crud in your source file, do it as
    follows.

    __version__ = "$Revision: 1.18 $"
    # $Source:
    # /cvsroot/python/python/nondist/peps/pep-0008.txt,v
    # $

   These lines should be included after the module's docstring, before
   any other code, separated by a blank line above and below.
"""

Abel Daniel