storage:vcs:git: check for existence of pygit2.__version__.
authorW. Trevor King <wking@tremily.us>
Mon, 17 Sep 2012 15:13:36 +0000 (11:13 -0400)
committerW. Trevor King <wking@tremily.us>
Mon, 17 Sep 2012 15:13:36 +0000 (11:13 -0400)
Now that my pull request has been accepted, we can be fairly confident
that future releases of pygit2 will expose this attribute.  The
accepted patch was a bit different from the original submission:

Add 'pygit2.__version__' for easy access from client software.
  https://github.com/libgit2/pygit2/pull/128
  commit f10d2b7b3f0c67d81b175326035e4813420156bd

libbe/storage/vcs/git.py

index 0a19f2fefe6b050cb1354a3b75f69431dd31a187..20dff39d46827659dfedf67cc6a8b276667803eb 100644 (file)
@@ -35,6 +35,11 @@ try:
 except ImportError, error:
     _pygit2 = None
     _pygit2_import_error = error
+else:
+    if not hasattr(_pygit2, '__version__'):
+        _pygit2 = None
+        _pygit2_import_error = NotImplementedError(
+            'pygit2 <= 0.17.2 not supported')
 
 import libbe
 from ...ui.util import user as _user