From 741c14b644a3c2a134163d2372e97ec70c3ae9bc Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 1 Jul 2008 00:46:07 +0200 Subject: Document detect() plugin methods --- src/nbblib/bs.py | 8 ++++++++ src/nbblib/plugins.py | 4 +++- src/nbblib/vcs.py | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/nbblib/bs.py b/src/nbblib/bs.py index 5b7b19b..43c3f44 100644 --- a/src/nbblib/bs.py +++ b/src/nbblib/bs.py @@ -45,6 +45,14 @@ class BSSourceTree(plugins.GenericDetectPlugin): repr(obj.tree_root), repr(vcs_tree.tree_root)) return obj.tree_root == vcs_tree.tree_root + @classmethod + def detect(cls, context, vcs_tree): + """Examine vcs_tree for build system has and return BSSourceTree obj + + @param vcs_tree the vcs.VCSourceTree object to examine + """ + super(BSSourceTree, cls).detect(context, vcs_tree) + def get_tree_root(self): return self._get_tree_root() tree_root = property(get_tree_root) diff --git a/src/nbblib/plugins.py b/src/nbblib/plugins.py index c42420d..8131426 100644 --- a/src/nbblib/plugins.py +++ b/src/nbblib/plugins.py @@ -56,7 +56,9 @@ class MyPluginB(MyPluginType): raise self.no_match_exception() Ideas: - * Get rid of references to "context", and handle that in derived classes. + * Get rid of references to 'context', and handle that in derived classes. + Bad idea, as any serious plugin using program will have the plugins + operating in some kind of context. """ diff --git a/src/nbblib/vcs.py b/src/nbblib/vcs.py index 6162f3c..ed7d73e 100644 --- a/src/nbblib/vcs.py +++ b/src/nbblib/vcs.py @@ -82,6 +82,14 @@ class VCSourceTree(plugins.GenericDetectPlugin): logging.debug("srcdir %s", srcdir) return obj.tree_root == srcdir + @classmethod + def detect(cls, context, srcdir): + """Examine srcdir for VCS system and return proper VCSourceTree obj + + @param srcdir string with absolute path of source code directory + """ + super(VCSourceTree, cls).detect(context, srcdir) + def get_config(self): """Get configuration object which determines builddir etc""" return AbstractConfig(self.tree_root, self.branch_name) -- cgit