summaryrefslogtreecommitdiff
path: root/cmd2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/__init__.py')
-rw-r--r--cmd2/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd2/__init__.py b/cmd2/__init__.py
index f61b7165..2de297d3 100644
--- a/cmd2/__init__.py
+++ b/cmd2/__init__.py
@@ -1,6 +1,14 @@
#
# -*- coding: utf-8 -*-
"""This simply imports certain things for backwards compatibility."""
-from .cmd2 import __version__, Cmd, Statement, EmptyStatement, categorize
+
+from pkg_resources import get_distribution, DistributionNotFound
+try:
+ __version__ = get_distribution(__name__).version
+except DistributionNotFound:
+ # package is not installed
+ pass
+
+from .cmd2 import Cmd, Statement, EmptyStatement, categorize
from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args, with_category
-from .pyscript_bridge import CommandResult \ No newline at end of file
+from .pyscript_bridge import CommandResult