diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 22fb10ffd..e55d0ab57 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -12,6 +12,22 @@ from sqlalchemy.orm import * from sqlalchemy.engine import create_engine from sqlalchemy.schema import default_metadata +def __figure_version(): + try: + from pkg_resources import require + import os + # NOTE: this only works when the package is either installed, + # or has an .egg-info directory present (i.e. wont work with raw SVN checkout) + info = require('sqlalchemy')[0] + if os.path.dirname(os.path.dirname(__file__)) == info.location: + return info.version + else: + return '(not installed)' + except: + return '(not installed)' + +__version__ = __figure_version() + def global_connect(*args, **kwargs): default_metadata.connect(*args, **kwargs)
\ No newline at end of file |