summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2008-07-01 19:10:23 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2008-07-15 12:28:55 +0200
commit527f8c816e4582799e8c3fe07c009bba9817a849 (patch)
treef72a4434d0cf280a17ded2f704fb3ad4a6739f50
parent100cb72230447059af8b68b1efd6765069d31648 (diff)
downloadnbb-527f8c816e4582799e8c3fe07c009bba9817a849.tar.gz
nbb-527f8c816e4582799e8c3fe07c009bba9817a849.tar.xz
nbb-527f8c816e4582799e8c3fe07c009bba9817a849.zip
Add logging to BS and VCS detection
-rw-r--r--src/nbblib/plugins.py4
-rw-r--r--src/nbblib/vcs.py13
2 files changed, 12 insertions, 5 deletions
diff --git a/src/nbblib/plugins.py b/src/nbblib/plugins.py
index 465df39..c71be79 100644
--- a/src/nbblib/plugins.py
+++ b/src/nbblib/plugins.py
@@ -221,13 +221,13 @@ class GenericPluginMeta(type):
# This must be a plugin implementation, which should be registered.
# Simply appending it to the list is all that's needed to keep
# track of it later.
- logging.debug("Registering %s together with %s", cls, cls.plugins)
def abstract_method_filter(member):
return hasattr(member, '__call__') \
and hasattr(member, 'abstract_method')
ams = inspect.getmembers(cls, abstract_method_filter)
if ams:
raise AbstractMethodsInConcreteClass(cls, ams)
+ logging.debug("Registering %s with %s as %s", cls, cls.plugins, cls.name)
cls.plugins[cls.name] = cls
else:
# This must be an abstract subclass of plugins.
@@ -304,12 +304,14 @@ class GenericDetectPlugin(object):
matches[key] = t
except PluginNoMatch, e:
pass
+ logging.debug("Matches: %s", matches)
if len(matches) > 1:
raise cls.ambigous_match_exception(matches,
cls, context,
*args, **kwargs)
elif len(matches) < 1:
raise cls.no_match_exception(*args, **kwargs)
+ logging.debug("Returning match from %s", matches)
return matches[matches.keys()[0]]
diff --git a/src/nbblib/vcs.py b/src/nbblib/vcs.py
index 1a0ad22..a78663f 100644
--- a/src/nbblib/vcs.py
+++ b/src/nbblib/vcs.py
@@ -77,6 +77,7 @@ class VCSourceTree(plugins.GenericDetectPlugin):
@classmethod
def validate(cls, obj, context, srcdir):
+ logging.debug("VCSourceTree.validate")
logging.debug("cls %s", cls)
logging.debug("obj %s", obj)
logging.debug("srcdir %s", srcdir)
@@ -201,11 +202,15 @@ class BzrSourceTree(VCSourceTree):
def __init__(self, context, srcdir):
super(BzrSourceTree, self).__init__(context)
try:
+ import bzrlib.errors
import bzrlib.workingtree
- wt,b = bzrlib.workingtree.WorkingTree.open_containing(srcdir)
- except bzrlib.errors.NotBranchError:
- raise self.no_match_exception(srcdir)
- except ImportError:
+ try:
+ wt,b = bzrlib.workingtree.WorkingTree.open_containing(srcdir)
+ except bzrlib.errors.NotBranchError:
+ logging.debug("Not a bzr branch: %s", repr(srcdir))
+ raise self.no_match_exception(srcdir)
+ except ImportError, e:
+ logging.warning("Cannot load bzrlib.*", exc_info=e)
raise self.no_match_exception(srcdir)
self.wt = wt
#print "wt:", wt