diff options
Diffstat (limited to 'cherrypy/__init__.py')
-rw-r--r-- | cherrypy/__init__.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cherrypy/__init__.py b/cherrypy/__init__.py index d90ffc7c..30a8cadf 100644 --- a/cherrypy/__init__.py +++ b/cherrypy/__init__.py @@ -56,10 +56,13 @@ with customized or extended components. The core API's are: These API's are described in the `CherryPy specification <https://bitbucket.org/cherrypy/cherrypy/wiki/CherryPySpec>`_. """ -__version__ = "3.6.1" +try: + import pkg_resources +except ImportError: + pass from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode -from cherrypy._cpcompat import basestring, unicodestr, set +from cherrypy._cpcompat import basestring, unicodestr from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect from cherrypy._cperror import NotFound, CherryPyException, TimeoutError @@ -88,6 +91,12 @@ except ImportError: engine = process.bus +try: + __version__ = pkg_resources.require('cherrypy')[0].version +except Exception: + __version__ = 'unknown' + + # Timeout monitor. We add two channels to the engine # to which cherrypy.Application will publish. engine.listeners['before_request'] = set() @@ -318,7 +327,7 @@ class _GlobalLogManager(_cplogging.LogManager): """Log the given message to the app.log or global log as appropriate. """ # Do NOT use try/except here. See - # https://bitbucket.org/cherrypy/cherrypy/issue/945 + # https://github.com/cherrypy/cherrypy/issues/945 if hasattr(request, 'app') and hasattr(request.app, 'log'): log = request.app.log else: |