[Zope-Coders] removing RCS ids causes error on startup

Barry A. Warsaw barry@zope.com
Fri, 5 Oct 2001 12:16:55 -0400


>>>>> "SA" == Steve Alexander <steve@cat-box.net> writes:

    SA> However, I find that ZServer/medusa/resolver.py won't start
    SA> up, because of this:

    SA> RCS_ID = '$Id$'

    SA> ...

    SA> VERSION = string.split(RCS_ID)[2]

The most robust way of doing version from RCS string is:

__version__ = '$Revision: 1.30 $'.split()[-2:][0]

which will work for either the retained-keys string, or the -kk
extracted version:

__version__ = '1.30'.split()[-2:][0]

This will "work" (defined as not crashing ;) when the key hasn't been
expanded at all:

__version__ = '$Revision$'.split()[-2:][0]

You can still include the $Id$ if you want, but it's probably better
to get the version number of $Revision$.

-Barry