SVN: Zope/trunk/ Removed the `App.version_txt.getZopeVersion` API, you can use ``pkg_resources.get_distribution('Zope2').version`` instead. Zope2's own code only calls the `version_txt` function returning a string.

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.web.zope.cvs
Message-ID <20110712095457.618E1941ED__40041.8813610033$1310464505$gmane$org@cvs.zope.org>
Log message for revision 122152:
  Removed the `App.version_txt.getZopeVersion` API, you can use ``pkg_resources.get_distribution('Zope2').version`` instead. Zope2's own code only calls the `version_txt` function returning a string.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/App/version_txt.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2011-07-11 19:36:55 UTC (rev 122151)
+++ Zope/trunk/doc/CHANGES.rst	2011-07-12 09:54:56 UTC (rev 122152)
@@ -44,6 +44,9 @@
 Restructuring
 +++++++++++++
 
+- Removed the `App.version_txt.getZopeVersion` API, you can use
+  ``pkg_resources.get_distribution('Zope2').version`` instead.
+
 - On the application object, removed `PrincipiaTime` in favor of `ZopeTime` and
   `PrincipiaRedirect` in favor of `Redirect` or `ZopeRedirect`.
 

Modified: Zope/trunk/src/App/version_txt.py
===================================================================
--- Zope/trunk/src/App/version_txt.py	2011-07-11 19:36:55 UTC (rev 122151)
+++ Zope/trunk/src/App/version_txt.py	2011-07-12 09:54:56 UTC (rev 122152)
@@ -10,50 +10,22 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
-"""Extract Zope 2 version information
-
-$id$
-"""
-import re
 import sys
 
 import pkg_resources
 
 _version_string = None
-_zope_version = None
 
+
 def _prep_version_data():
-    global _version_string, _zope_version
+    global _version_string
     if _version_string is None:
         v = sys.version_info
         pyver = "python %d.%d.%d, %s" % (v[0], v[1], v[2], sys.platform)
         dist = pkg_resources.get_distribution('Zope2')
-
-        expr = re.compile(
-            r'(?P<major>[0-9]+)\.(?P<minor>[0-9]+)\.(?P<micro>[0-9]+)'
-            '(?P<status>[A-Za-z]+)?(?P<release>[0-9]+)?')
-
-        dict = expr.match(dist.version).groupdict()
-        _zope_version = (
-            int(dict.get('major') or -1),
-            int(dict.get('minor') or -1),
-            int(dict.get('micro') or -1),
-            dict.get('status') or '',
-            int(dict.get('release') or -1),
-            )
         _version_string = "%s, %s" % (dist.version, pyver)
 
 
 def version_txt():
     _prep_version_data()
     return '(%s)' % _version_string
-
-
-def getZopeVersion():
-    """
-    Format of zope_version tuple:
-    (major <int>, minor <int>, micro <int>, status <string>, release <int>)
-    If unreleased, integers may be -1.
-    """
-    _prep_version_data()
-    return _zope_version

_______________________________________________
Zope-Checkins maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.