On Sun, Feb 05, 2017 at 01:13:19PM -0700, Simon Glass wrote: > Add Python bindings for a bare-bones set of libfdt functions. These allow > navigating the tree and reading node names and properties. > > Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx> > --- > > Changes in v4: > - Make the library less pythonic to avoid a shaky illusion > - Drop classes for Node and Prop, along with associated methods > - Include libfdt.h instead of repeating it > - Add support for fdt_getprop() > - Bring in all libfdt functions (but Python support is missing for many) > - Add full comments for Python methods > > Changes in v3: > - Make the library more pythonic > - Add classes for Node and Prop along with methods > - Add an exception class > - Use Python to generate exeptions instead of SWIG > > Changes in v2: > - Add exceptions when functions return an error > - Correct Python naming to following PEP8 > - Use a class to encapsulate the various methods > - Include fdt.h instead of redefining struct fdt_property > - Use bytearray to avoid the SWIG warning 454 > - Add comments > > pylibfdt/.gitignore | 3 + > pylibfdt/Makefile.pylibfdt | 18 ++ > pylibfdt/libfdt.swig | 565 +++++++++++++++++++++++++++++++++++++++++++++ > pylibfdt/setup.py | 34 +++ > 4 files changed, 620 insertions(+) > create mode 100644 pylibfdt/.gitignore > create mode 100644 pylibfdt/Makefile.pylibfdt > create mode 100644 pylibfdt/libfdt.swig > create mode 100644 pylibfdt/setup.py > > diff --git a/pylibfdt/.gitignore b/pylibfdt/.gitignore > new file mode 100644 > index 0000000..5e8c5e3 > --- /dev/null > +++ b/pylibfdt/.gitignore > @@ -0,0 +1,3 @@ > +libfdt.py > +libfdt.pyc > +libfdt_wrap.c > diff --git a/pylibfdt/Makefile.pylibfdt b/pylibfdt/Makefile.pylibfdt > new file mode 100644 > index 0000000..fa74dd2 > --- /dev/null > +++ b/pylibfdt/Makefile.pylibfdt > @@ -0,0 +1,18 @@ > +# Makefile.pylibfdt > +# > + > +PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) > +WRAP = $(PYLIBFDT_objdir)/libfdt_wrap.c > +PYMODULE = $(PYLIBFDT_objdir)/_libfdt.so > + > +$(PYMODULE): $(PYLIBFDT_srcs) $(WRAP) > + @$(VECHO) PYMOD $@ > + python $(PYLIBFDT_objdir)/setup.py "$(CPPFLAGS)" $^ > + mv _libfdt.so $(PYMODULE) > + > +$(WRAP): $(PYLIBFDT_srcdir)/libfdt.swig > + @$(VECHO) SWIG $@ > + swig -python -o $@ $< Forgot to mention this before: please wrap this in a $(SWIG) make variable. -- 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