[XML-SIG] Availability of libxml2 and libxslt Python bindings

Daniel Veillard veillard@redhat.com
Fri, 22 Feb 2002 18:16:36 -0500

On Thu, Feb 21, 2002 at 02:19:22PM -0500, Fred L. Drake, Jr. wrote:
> Actually, I think there is another option, but it really wonderful
> either.  It might be better than this.  Both C extension modules can
> be implemented by a single .so this way:
> 1. Implement two internal functions that do what the current
>    init<module> functions do; let's call these _init_1 and _init_2.
> 2. Write *two* init<module> functions (initA and initB), each of which
>    calls both _init_1 and _init_2.
> 3. Install the .so as A.so *and* B.so, so it doesn't matter which gets
>    imported first.  When imported, both modules are initialized and
>    inserted in sys.modules, so subsequent imports will pick up the
>    cached module.
> Somewhat painful, but it should avoid these library dependence
> problems, at least in this case.

   Okay, I have tried to do somthing along those lines. The setup.py
is "abnormaly" complex due to the fact:
    - that it generates the stubs for both libraries
    - it is tweaked to also be able to run from libxml2 distrib
      python subdir
    - that it may be used to build only the libxml2 package.

It requires xmllib or sgmlop to parse the APIs descriptions, but 
it seems to work even on my ancient 1.5 setup.

  I have uploaded the binding package at [*]

It's probably not very portable, not that the C code is not portable but
I have no idea of the conventions needed to access libxml2 or libxslt
on Windows, nor how to "detect" the prefix for the include paths on Unix
from the python code (currently hardcoded to /usr/include/libxml2 and
/usr/include/libxslt). Portability patches are of course welcome.

I also didn't included the test in the package, the documentation on
distribuing python modules may be outdated (the PDF one) it says that
there is framework for tests but not implemented. So I left that out
for the moment.


[*] that package is actually build from my development trees of libxml2
    and libxslt by a shell script merging the python parts and checking
    setup.py build sdist in that directory

Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/