Mercurial > babel > old > babel-test
diff babel/__init__.py @ 388:1c54b64a93bf
More graceful `__version__` initialization when Babel is not installed in a way Setuptools knows about it.
author | cmlenz |
---|---|
date | Mon, 14 Jul 2008 13:02:16 +0000 |
parents | a2c54ef107c2 |
children | 85e1beadacb0 |
line wrap: on
line diff
--- a/babel/__init__.py +++ b/babel/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2007 Edgewall Software +# Copyright (C) 2007-2008 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which @@ -30,6 +30,10 @@ __docformat__ = 'restructuredtext en' try: - __version__ = __import__('pkg_resources').get_distribution('Babel').version + from pkg_resources import get_distribution, ResolutionError + try: + __version__ = get_distribution('Babel').version + except ResolutionError: + __version__ = None # unknown except ImportError: - pass + __version__ = None # unknown