Mercurial > genshi > mirror
changeset 768:f5d5afd2df2b trunk
Make the code that retrieves the Genshi version via `pkg_resources` handle the case of missing egg metadata more gracefully. Closes #241.
author | cmlenz |
---|---|
date | Tue, 01 Jul 2008 09:07:38 +0000 |
parents | b5b4b465e84c |
children | 3a59144a35b1 |
files | genshi/__init__.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/genshi/__init__.py +++ b/genshi/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2006-2007 Edgewall Software +# Copyright (C) 2006-2008 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which @@ -21,9 +21,13 @@ __docformat__ = 'restructuredtext en' try: - __version__ = __import__('pkg_resources').get_distribution('Genshi').version + from pkg_resources import get_distribution, ResolutionError + try: + __version__ = get_distribution('Genshi').version + except ResolutionError: + __version__ = None # unknown except ImportError: - pass + __version__ = None # unknown from genshi.core import * from genshi.input import ParseError, XML, HTML