Andrew Bennetts andrew at canonical.com
Thu Jun 15 14:25:43 BST 2006

Robert Collins wrote:
> On Wed, 2006-06-14 at 12:17 +1000, Martin Pool wrote:
> > 
> > If possible I'd like them to actually be plugins loaded through the  
> > regular mechanism.  They may need to patch themselves into bzr and  
> > perhaps it's not always possible, but something to aim for.
> I think that that increases the chance of skew in a single users install
> between their C and python versions, and it does not change the ease or
> difficulty of testing both implementations : either the thing they
> replace has a factory where we can control the one used, or it acts like
> a singleton, and we have to just test one during a test run.
> The current test branch runs tests completely, then builds the
> extensions and runs again. Its not completely ideal, but it achieves my
> key goals:
>  * Ensure that a python version exists and works.
>  * Ensure that the C versions when built still pass tests.

Why not do it this way: for some feature foo with an optional C implementation,
have a foo.py that simply consists of:

          from _c_foo import *
     except ImportError:
          from _py_foo import *

Where _c_foo would be the "foo" module in C, and _py_foo would be the pure
python fallback.  Tests for "foo" can directly access both _c_foo and _py_foo
modules to make sure they both pass.  Callers of foo get the C version if
available, and automatically get the python version if not. 

I don't think the plugin infrastructure helps solve this problem.


More information about the bazaar mailing list