On Tue, Mar 21, 2017 at 10:02:00AM -0600, Simon Glass wrote: > Hi David, > > On 20 March 2017 at 23:35, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote: > > On Fri, Mar 17, 2017 at 04:14:29PM -0600, Simon Glass wrote: > >> At present libfdt consists of only a C implementation. Many scripts are > >> written using Python so it useful to have Python bindings for libfdt. > >> Apparently this has never been attempted before, or if so I cannot find a > >> reference. > >> > >> This series starts the process of adding this support, with just a > >> bare-bones set of methods. > >> > >> The v11 series provides binding that can be used like this: > >> > >> fdt = libfdt.Fdt(open(fname).read()) > >> node = fdt.path_offset('/subnode@1') > >> print fdt.get_prop(node, 'compatible') > >> subnode = fdt.first_subnode(node, quiet=[libfdt.NOTFOUND]) > >> while subnode > 0: > >> print fdt.get_name(subnode) > >> subnode = fdt.next_subnode(subnode, quiet=[libfdt.NOTFOUND]) > >> > >> This version includes a simple class for properties. > > > > Applied to master. I made a small change in the last patch, so that > > the error message when the python packages aren't installed is less > > scary looking. > > Yes that is better, but note the 'pylibgfdt' typo. Oops. Fixed now. > I suppose it is too soon for a new release tag? Pretty much, yes. > I'm also interested in your thoughts on where to take this next. > Presumably we should support the rest of the functions in libfdt. Yes, I think that's a good idea. As suggested earlier, I think getting to the point where you can do a complete Python re-implementation of the tree1_tests would be a good interim goal, I think. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature