RE: [xml] python bindings on windows



Igor, Daniel, 

1. Add a few missing exports to libxml2.def.src:
[...] 
and libxslt.def.src
 > [...]

This is okay, I'll apply it.

Thanks.
 
2. #include "config.h" does not work on Windows.
[...] 

It's libxml file. Autogenerated, nonexistent on Windows. We 
must either 
modify win32config.h to offer all Python needs, or generate a 
config.h at 
compile time (and thus obsolete the win32config.h). Both 
options are equally 
possible.

Since I commented it out, it's definitely not needed on Windows.
Given Daniel's answer,

  Hum, I don't remember why I had to include it ...

I guess it's worth trying to remove it or
wrap it in #ifndef WINDOWS (or whatever the
correct define it is).
 
You will have to :-) If these changes break nothing, I see no 
reason why the 
shouldn't be applied.

The adapted setup.py is attached.
I've tried to change only where necessary.
A diff with setup.py.in should show what I intended
to do better than long explanations.

About the installation, in the case of binaries, a batch file 
does it, 
because all of it is just a file copy. No special 
registration needed. If 
you prefer a full-featured installer, go ahead, but try to 
make it usable on 
as many Windows incarnations as possible.

Actually, I don't want to make a windows installer for libxml.
(I think it's better for each application to have a private copy of it). 

What I want to do, is to make a windows installer for
the python bindings, because this is how it is traditionally
done in the world of python on windows, using distutils. 
And I find it easier and safer for the python bindings 
to have their private copy of the libxml dlls.

In my experience, the windows installers produced by distutils
are pretty bulletproof.

I would in any case be interested in building the Python 
bindings through 
the libxml build system for Windows, as described in win32/Readme.txt.

Building and packaging python extensions is traditionally
done using python's distutils (setup.py), also on windows.
What I would suggest is using configure.js to create
setup.py from setup.py.in, and then run setup.py to
build and package the python extensions.

In the attached setup.py, I've put a few comments
where I think things could be generated by configure.js
(look for the string "TBC" in the file).

Igor, if you wish to try it out, all you need is
a python 2.x installation. Below, I've also pasted the script
I use to build libxml, libxslt, and the python bindings.

-sbi

--------------------------------------------------------------
.cmd script pasted (beware of long lines)
--------------------------------------------------------------
set PFX=e:\download\_cvs\gnome\_bin

cd gnome-xml\win32
cscript configure.js prefix=%PFX% bindir=%PFX%\bin libdir=%PFX%\lib incdir=%PFX%\include\libxml2 
sodir=%PFX%\bin include=%PFX%\include lib=%PFX%\lib 
nmake clean
nmake install
cd ..\..

cd libxslt\win32
cscript configure.js prefix=%PFX% bindir=%PFX%\bin libdir=%PFX%\lib incdir=%PFX%\include sodir=%PFX%\bin 
include=%PFX%\include;%PFX%\include\libxml2 lib=%PFX%\lib
nmake clean
nmake install
cd ..\..

cd gnome-xml\python
del /S /Q build
del generator.pyc libxml2-export.c libxml2-py.c libxml2-py.h libxml2.py libxml2class.py libxsl.py 
libxslt-api.xml libxslt-export.c libxslt-py.c libxslt-py.h libxslt-python-api.xml libxslt.py libxsltclass.py 
libxsltclass.txt MANIFEST xsltgenerator.py xsltgenerator.pyc
copy ..\..\libxslt\python\generator.py xsltgenerator.py
copy ..\..\libxslt\doc\libxslt-api.xml 
copy ..\..\libxslt\python\libxslt-python-api.xml 
copy ..\..\libxslt\python\libxsl.py
copy ..\..\libxslt\python\libxslt.c
copy ..\..\libxslt\python\libxslt_wrap.h
rem create the installer in gnome-xml\python\dist
python setup.py bdist_wininst
cd ..\..

Attachment: setup.py
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]