[Zope] Re: Detect ZOPE version inside a product

Simon Michael simon@joyful.com
Fri, 06 Dec 2002 09:22:08 -0800


Tino may be right, but I do this::

 try:
     v = open(os.path.join(SOFTWARE_HOME,'version.txt')).read()
     m = re.match(r'(?i)zope\s*([0-9]+)\.([0-9]+)\.([0-9]+)',v)
     ZOPEVERSION = (int(m.group(1)),int(m.group(2)),int(m.group(3)))
 except:
     # if we can't read version.txt, assume we're dealing with a
     # highly advanced specimen.. (cvs)
     ZOPEVERSION = (9,9,9)