[augeas-devel] Simple pyGTK Augeas viewer

David Malcolm dmalcolm at redhat.com
Fri Mar 13 02:32:53 UTC 2009


On Tue, 2009-03-10 at 17:11 -0700, David Lutterkort wrote:
> On Tue, 2009-03-10 at 19:23 -0400, David Malcolm wrote:
> > On Sun, 2009-03-08 at 20:30 -0700, David Lutterkort wrote:
> > > On Sat, 2009-03-07 at 12:33 -0500, David Malcolm wrote:
> > > > I was playing around with the python augeas bindings.
> > > > 
> > > > Attached is a simple pygtk app that lets you browse the full Augeas
> > > > tree, in a two column Path/Value treeview.
> > > 
> > > Nice :) Unfortunately, this segfaults for me on an F10 machine somewhere
> > > in _ctypes.so while its callin free(). Not sure what that is - an error
> > > in the bindings ?
> > 
> > Not sure.  For reference, it's working for me with these rpms:
> > augeas-devel-0.3.6-1.fc10.i386
> > python-augeas-0.3.0-1.fc10.noarch
> > augeas-libs-0.3.6-1.fc10.i386
> > augeas-0.3.6-1.fc10.i386
> > augeas-debuginfo-0.3.3-1.fc10.i386
> 
> Found the problem (this is with augeas-0.4.2, but will cause trouble
> with any Augeas >= 0.4.0): the very  first call to populate_tree_store
> is with a path of "/", resulting in a call to aug.match("//*") which
> since Augeas 0.4.0 means 'any node anywhere in the tree', following the
> XPath syntax.
> 
> If you change populate_tree_store to (sorry for the non-diff):
> 
>             def populate_tree_store(self, path, parent_iter):
>                 iter = self.treestore.append(parent_iter, [path, self.aug.get(path)])
>                 if path == "/":
>                     path = ""
>                 try:
>                     child_paths = self.aug.match(path+'/*')
>                 except RuntimeError:
>                     return
>                 for path in child_paths:
>                     self.populate_tree_store(path, iter),
> 
> But even with that, it still dies 3 out of 4 times somewhere deep in the
> guts of python - but at leasy I've seen the UI ;)

Attached is an updated version, with the above change, plus a right-hand
pane which tried to show you the file corresponding to the
currently-selected node.

[snip]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: augview.py
Type: text/x-python
Size: 2253 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20090312/fc800dca/attachment.py>


More information about the augeas-devel mailing list