diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-08-23 17:33:36 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-08-23 17:33:36 +0100 |
commit | d35e67b8f7df3512f19ee98f729d6d9cc0072f09 (patch) | |
tree | 7e5962c4af753c2b9a1dbdce67466b3358961fc7 | |
parent | dfbdd0009ccccf276e88121c3c545a7edecbdc9e (diff) | |
download | obnam-d35e67b8f7df3512f19ee98f729d6d9cc0072f09.tar.gz |
Don't require _obnam extension always.
-rw-r--r-- | obnamlib/__init__.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/obnamlib/__init__.py b/obnamlib/__init__.py index 3c47aba9..f833878e 100644 --- a/obnamlib/__init__.py +++ b/obnamlib/__init__.py @@ -20,7 +20,19 @@ import cliapp __version__ = '0.21' -import _obnam + +# Import _obnam if it is there. We need to be able to do things without +# it, especially at build time, while we're generating manual pages. +# If _obnam is not there, substitute a dummy that throws an exception +# if used. +class DummyExtension(object): + def __getattr__(self, name): + raise Exception('Trying to use _obnam, but that was not found.') +try: + import _obna +except ImportError: + _obnam = DummyExtension() + from pluginmgr import PluginManager |