[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl - IZopeVersion.py:1.1.2.1 ZopeVersion.py:1.1.2.1
Philipp von Weitershausen
philikon@gmx.net
Tue, 9 Apr 2002 09:57:07 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ApplicationControl
In directory cvs.zope.org:/tmp/cvs-serv21725
Added Files:
Tag: Zope-3x-branch
IZopeVersion.py ZopeVersion.py
Log Message:
- introduced the IZopeVersion interface and utility to retrieve information about
the current zope version
=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/IZopeVersion.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
__doc__ = """Zope version
$Id: IZopeVersion.py,v 1.1.2.1 2002/04/09 13:57:07 philikon Exp $"""
from Interface import Interface
class IZopeVersion(Interface):
""" Zope version """
def getZopeVersion():
"""Return a string containing the Zope version (possibly including
CVS information)"""
=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/ZopeVersion.py ===
from Zope.App.OFS.ApplicationControl.IZopeVersion import IZopeVersion
import os
class ZopeVersion:
__implements__ = IZopeVersion
############################################################
# Implementation methods for interface
# Zope.App.OFS.ApplicationControl.IZopeVersion.
def getZopeVersion(self):
'See Zope.App.OFS.ApplicationControl.IZopeVersion.IZopeVersion'
version_id = "Development/Unknown"
version_tag = ""
is_cvs = 0
import Zope
zopedir = os.path.dirname(Zope.__file__)
# is this a CVS checkout?
cvsdir = os.path.join(zopedir, "CVS" )
if os.path.isdir(cvsdir):
is_cvs = 1
tagfile = os.path.join(cvsdir, "Tag")
# get the tag information
if os.path.isfile(tagfile):
f = open(tagfile)
tag = f.read()
if tag[0] == "T":
version_tag = " (%s)" % tag[1:-1]
# try to get official Zope release information
versionfile = os.path.join(zopedir, "version.txt")
if os.path.isfile(versionfile) and not is_cvs:
f = open(versionfile)
version_id = f.read().split("\n")[0]
version = "%s%s" % (version_id, version_tag)
return version
#
############################################################