[Zope-Coders] Slightly better Zope version reporting

Jeffrey P Shell jeffrey@cuemedia.com
Mon, 19 Nov 2001 12:12:54 -0700


After confusing myself a-plenty with the inability to distinguish 
via the Control_Panel whether I was running my checkout of Zope 
2.4.x, or the Head, I made the following quick adjustment to 
lib/python/App/version_txt.py in my sandbox to at least tell me if 
I'm running a tagged checkout.

It's not elegant, and I have no intention of checking it in, but I 
do want to ask why SOFTWARE_HOME/version.txt is not always 
available and just updated to report a version similar to what 
Python CVS checkouts report (a current checkout of Python reports 
'Python 2.2b2+').

def version_txt():

     py_info = "python %d.%d.%d" % (v[0], v[1], v[2])
     try:
         v_info = open(os.path.join(SOFTWARE_HOME, 'version.txt')).read()
         v_info = re.sub("\(.*?\)\?","",v_info)
     except:
         try:
             v_info = open(os.path.join(SOFTWARE_HOME, 'CVS', 
'Tag')).read()
             v_info = 'cvs tagged version: %s' % v_info[1:].strip()
         except:
             v_info = 'unreleased version'
     return '(%s, %s %s)' % (v_info, py_info, sys.platform)

Jeffrey P Shell, jeffrey@cuemedia.com