diff --git a/ChangeLog b/ChangeLog index efd54e46..b7304060 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Feb 9 19:04:01 CET 2002 Daniel Veillard + + * configure.in libxslt.spec.in python/Makefile.am python/generator.py + python/libxsl.py python/libxslt.c python/tests/Makefile.am: + Fixed the python Makefiles, corrected a bug showing up on ia64, + changed the name of the python internal module too + Fri Feb 8 17:01:10 CET 2002 Daniel Veillard * Copyright Makefile.am configure.in libxslt.spec.in: change the diff --git a/configure.in b/configure.in index 5d872049..ef01ca26 100644 --- a/configure.in +++ b/configure.in @@ -152,14 +152,14 @@ if test "$with_python" != "no" ; then echo Found Python version $PYTHON_VERSION LIBXML2_PYTHON=`python -c "try : import libxml2 ; print 1 except: print 0"` - if test "$LIBXML2_PYTHON" == "1" + if test "$LIBXML2_PYTHON" = "1" then echo Found libxml2-python module else echo Missing libxml2-python fi fi - if test "$PYTHON_VERSION" != "" -a "$LIBXML2_PYTHON" == "1" + if test "$PYTHON_VERSION" != "" -a "$LIBXML2_PYTHON" = "1" then if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ -d $with_python/lib/python$PYTHON_VERSION/site-packages @@ -342,7 +342,7 @@ if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then LIBXML_LIBS="../../XML/.libs/libxml2.a -lz" DV_LINK="1" XSLTPROCDV="xsltproc.dv" - PYTHONSODV="_libxslt.so.dv" + # PYTHONSODV="libxsltmod.so.dv" fi AC_SUBST(XSLTPROCDV) diff --git a/libxslt.spec.in b/libxslt.spec.in index 6b3578c0..ef177f70 100644 --- a/libxslt.spec.in +++ b/libxslt.spec.in @@ -10,6 +10,7 @@ URL: http://xmlsoft.org/XSLT/ Requires: libxml2 >= @LIBXML_REQUIRED_VERSION@ BuildRequires: libxml2-devel >= @LIBXML_REQUIRED_VERSION@ BuildRequires: python python-devel +BuildRequires: libxml2-python Prefix: %{_prefix} Docdir: %{_docdir} @@ -130,10 +131,12 @@ rm -rf $RPM_BUILD_ROOT %doc AUTHORS ChangeLog NEWS README Copyright FEATURES %{prefix}/lib/python*/site-packages/libxslt.py -%{prefix}/lib/python*/site-packages/_libxslt.so +%{prefix}/lib/python*/site-packages/libxsltmod.so %doc python/TODO %doc python/libxsltclass.txt %doc python/tests/*.py +%doc python/tests/*.xml +%doc python/tests/*.xsl %changelog diff --git a/libxslt/templates.c b/libxslt/templates.c index ea44a1d4..064394e5 100644 --- a/libxslt/templates.c +++ b/libxslt/templates.c @@ -218,7 +218,7 @@ xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) { if (str == NULL) return(NULL); if (*str == 0) - return(xmlStrndup("", 0)); + return(xmlStrndup((xmlChar *)"", 0)); cur = str; while (*cur != 0) { diff --git a/python/Makefile.am b/python/Makefile.am index 229bf4a0..74c97547 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -1,11 +1,15 @@ +# Makefile for libxml2 python library +AUTOMAKE_OPTIONS = 1.4 foreign + SUBDIRS= . tests -LIBS=-L../libxslt/.libs -L../libxslt -lxslt -L../libexslt/.libs -L../libexslt -lexslt # $(PYTHON_SITE_PACKAGES)/_libxml.so $(LIBXML_LIBS) -INCLUDES=-I/usr/include/python$(PYTHON_VERSION) -I$(PYTHON_INCLUDES) $(LIBXML_CFLAGS) -I$(top_srcdir) -SHCFLAGS=$(INCLUDES) -Wall -fPIC -g -LINK_FLAGS= -shared -DOCS_DIR = $(prefix)/share/doc/libxslt-python-$(LIBXML_VERSION) +INCLUDES = \ + -I/usr/include/python$(PYTHON_VERSION) \ + -I$(PYTHON_INCLUDES) \ + $(LIBXML_CFLAGS) \ + -I$(top_srcdir) +DOCS_DIR = $(prefix)/share/doc/libxslt-python-$(LIBXML_VERSION) DOCS = TODO libxsltclass.txt EXTRA_DIST = \ @@ -19,37 +23,39 @@ EXTRA_DIST = \ $(DOCS) if WITH_PYTHON -all: _libxslt.so libxslt.py $(PYTHONSODV) +mylibs = \ + $(top_builddir)/libxslt/libxslt.la \ + $(top_builddir)/libexslt/libexslt.la + +all: libxsltmod.so libxslt.py $(PYTHONSODV) + +LDADD = -lxslt -lexslt +CFLAGS = -Wall -g + +pythondir = $(prefix)/lib/python${PYTHON_VERSION}/site-packages +python_PROGRAMS = libxsltmod.so + +libxsltmod_so_SOURCES = +libxsltmod_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,libxsltmod.so + +noinst_LTLIBRARIES = libxsltmodule.la +libxsltmodule_la_SOURCES = libxslt.c types.c libxslt-py.c + +libxsltmod.so: $(libxsltmodule_la_OBJECTS) + -@rm -f .libs/libxsltmod.so + $(LINK) -o $@ $(libxsltmodule_la_OBJECTS) $(libxsltmod_so_LDFLAGS) + -@(if [ -r .libs/libxsltmod.so ] ; then cp .libs/libxsltmod.so . ; fi) + libxslt.py: $(srcdir)/libxsl.py libxsltclass.py cat $(srcdir)/libxsl.py libxsltclass.py > libxslt.py -_libxslt.so: libxslt.o libxslt-py.o types.o - $(CC) $(LINK_FLAGS) libxslt.o libxslt-py.o types.o $(LIBS) -o _libxslt.so - -_libxslt.so.dv: libxslt.o libxslt-py.o types.o - rm -f _libxslt.so - $(CC) $(LINK_FLAGS) -o _libxslt.so libxslt.o libxslt-py.o types.o -L../libxslt/.libs -L../libxslt -lxslt -L../libexslt/.libs -L../libexslt -lexslt # $(HOME)/XML/python/_libxml.so $(HOME)/XML/.libs/libxml2.a - install-data-local: $(mkinstalldirs) $(DESTDIR)$(PYTHON_SITE_PACKAGES) -@INSTALL@ -m 0644 libxslt.py $(DESTDIR)$(PYTHON_SITE_PACKAGES) - -@INSTALL@ -m 0755 _libxslt.so $(DESTDIR)$(PYTHON_SITE_PACKAGES) $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR) -@(for doc in $(DOCS) ; \ do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done) -else -all: -endif - -libxslt.o: libxslt.c libxslt-export.c libxslt_wrap.h - $(CC) $(SHCFLAGS) -c -o libxslt.o $(srcdir)/libxslt.c - -types.o: types.c libxslt_wrap.h - $(CC) $(SHCFLAGS) -c -o types.o $(srcdir)/types.c - -libxslt-py.o: libxslt-py.c libxslt-py.h libxslt_wrap.h - $(CC) $(SHCFLAGS) -c -o libxslt-py.o $(srcdir)/libxslt-py.c GENERATE = generator.py API_DESC = $(top_srcdir)/doc/libxslt-api.xml $(srcdir)/libxslt-python-api.xml @@ -61,10 +67,13 @@ GENERATED= $(srcdir)/libxsltclass.py \ $(GENERATED): $(srcdir)/$(GENERATE) $(API_DESC) cd $(srcdir) && $(PYTHON) $(GENERATE) +else +all: +endif tests test: all cd tests && $(MAKE) tests clean: - rm -f $(GENERATED) *.o _libxslt.so *.pyc libxslt.py + rm -f $(GENERATED) *.o libxslt.so *.pyc libxslt.py diff --git a/python/generator.py b/python/generator.py index 8f7332c6..fb792b86 100755 --- a/python/generator.py +++ b/python/generator.py @@ -382,7 +382,7 @@ def print_function_wrapper(name, output, export, include): include.write("PyObject * ") include.write("libxslt_%s(PyObject *self, PyObject *args);\n" % (name)) - export.write(" { \"%s\", libxslt_%s, METH_VARARGS },\n" % (name, name)) + export.write(" { \"%s\", libxslt_%s, METH_VARARGS, NULL },\n" % (name, name)) if file == "python": # Those have been manually generated @@ -746,7 +746,7 @@ if function_classes.has_key("None"): classes.write(" ret = "); else: classes.write(" "); - classes.write("_libxslt.%s(" % name) + classes.write("libxsltmod.%s(" % name) n = 0 for arg in args: if n != 0: @@ -805,7 +805,7 @@ for classname in classes_list: classes.write(" pass\n") else: classes.write(" if self._o != None:\n") - classes.write(" _libxslt.%s(self._o)\n" % + classes.write(" libxsltmod.%s(self._o)\n" % classes_destructors[classname]); classes.write(" self._o = None\n\n"); flist = function_classes[classname] @@ -852,7 +852,7 @@ for classname in classes_list: classes.write(" ret = "); else: classes.write(" "); - classes.write("_libxslt.%s(" % name) + classes.write("libxsltmod.%s(" % name) n = 0 for arg in args: if n != 0: diff --git a/python/libxsl.py b/python/libxsl.py index 57e3d05b..d482af3f 100644 --- a/python/libxsl.py +++ b/python/libxsl.py @@ -1,5 +1,5 @@ -import _libxml -import _libxslt +import libxml2mod +import libxsltmod import libxml2 # diff --git a/python/libxslt.c b/python/libxslt.c index d9bc5b8c..ec7e4d76 100644 --- a/python/libxslt.c +++ b/python/libxslt.c @@ -349,11 +349,12 @@ libxslt_xsltCleanup(PyObject *self, PyObject *args) { ************************************************************************/ static PyMethodDef libxsltMethods[] = { #include "libxslt-export.c" + { NULL, NULL, NULL, NULL } }; -void init_libxslt(void) { +void initlibxsltmod(void) { PyObject *m; - m = Py_InitModule("_libxslt", libxsltMethods); + m = Py_InitModule("libxsltmod", libxsltMethods); /* libxslt_xmlErrorInitialize(); */ /* * Specific XSLT initializations diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 478e1087..8cc110d0 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -1,4 +1,4 @@ -EXAMPLE_DIR = $(prefix)/share/doc/libxslt-python-$(LIBXML_VERSION)/examples +EXAMPLE_DIR = $(prefix)/share/doc/libxslt-python-$(LIBXSLT_VERSION)/examples TESTSPY= \ basic.py \ @@ -11,7 +11,7 @@ XMLS= \ EXTRAS= \ pyxsltproc.py -EXTRA_DIST = $(TESTSPY) $(XMLS) +EXTRA_DIST = $(TESTSPY) $(XMLS) $(EXTRAS) if WITH_PYTHON tests: $(TESTSPY)