Python & libxml2/libxslt/gamin



Hi,

I'm still running Fedora 3, which comes with Python 2.3. Because dbus
needs at least Python 2.4, I compiled and installed 2.4 in /usr/local.
dbus finds this version just fine, but libxml2, libxslt and gamin now
fail to build their python stuff. Something like this issue has been
covered before on this list:

http://mail.gnome.org/archives/garnome-list/2005-July/msg00199.html

Joseph Sacco encouraged the author of libxml2/libxslt/gamin to add
support for the PYTHON environment variable in the configure scripts,
but that doesn't work for me. PYTHON is found, but the headers are not.

Attached is a patch for the libxml2 garball. The libxml2/configure.in
script now uses a canned Automake macro to find the Python headers. The
macro, added to libxml2/acinclude.m4, is taken from the dbus package.
The Makefile for the garball now runs autoreconfig before configure to
regenerate the configure script and a Makefile where I twiddled
Makefile.am.

I've never played with autotools before and I'm not a programmer, but
this compiles successfully, and the resulting garnome suite seems to
work. However, I don't know how to really test the libxml2 python stuff,
could someone tell me how?

Also, if this works for others, I've got similar (almost identical)
patches for libxslt and gamin. Let me know if I should post them to 
the list.

By the way, thanks for garnome.

Kenneth

diff -Npru libxml2.orig/checksums libxml2/checksums
--- libxml2.orig/checksums	2005-11-13 16:25:47.000000000 -0700
+++ libxml2/checksums	2006-01-09 08:24:00.000000000 -0700
@@ -1,2 +1,3 @@
 5bf7e6bc7164ae0f5a6cc5ff693a4180  download/libxml2-2.6.22.tar.bz2
 4e9a20574f3bb6e271d18337aa3623ea  download/buildDocBookCatalog
+a4fa4ef5eda6991825a2dbb32df25cb6  download/python-path-fixes.diff
diff -Npru libxml2.orig/files/python-path-fixes.diff libxml2/files/python-path-fixes.diff
--- libxml2.orig/files/python-path-fixes.diff	1969-12-31 17:00:00.000000000 -0700
+++ libxml2/files/python-path-fixes.diff	2006-01-09 08:24:00.000000000 -0700
@@ -0,0 +1,147 @@
+diff -Npru libxml2-2.6.22.orig/acinclude.m4 libxml2-2.6.22/acinclude.m4
+--- libxml2-2.6.22.orig/acinclude.m4	2005-01-04 07:49:46.000000000 -0700
++++ libxml2-2.6.22/acinclude.m4	2006-01-01 21:25:06.000000000 -0700
+@@ -26,3 +26,29 @@ ifelse([$4], , , [  rm -rf conftest*
+ ])dnl
+ fi
+ rm -f conftest*])
++
++dnl a macro to check for ability to create python extensions
++dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
++dnl function also defines PYTHON_INCLUDES
++AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
++[AC_REQUIRE([AM_PATH_PYTHON])
++AC_MSG_CHECKING(for headers required to compile python extensions)
++dnl deduce PYTHON_INCLUDES
++py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
++py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
++PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
++if test "$py_prefix" != "$py_exec_prefix"; then
++  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
++fi
++AC_SUBST(PYTHON_INCLUDES)
++dnl check if the headers exist:
++save_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
++AC_TRY_CPP([#include <Python.h>],dnl
++[AC_MSG_RESULT(found)
++$1],dnl
++[AC_MSG_RESULT(not found)
++$2])
++CPPFLAGS="$save_CPPFLAGS"
++])
++
+diff -Npru libxml2-2.6.22.orig/configure.in libxml2-2.6.22/configure.in
+--- libxml2-2.6.22.orig/configure.in	2005-09-12 14:17:14.000000000 -0700
++++ libxml2-2.6.22/configure.in	2006-01-01 21:24:59.000000000 -0700
+@@ -612,80 +612,31 @@ esac
+ dnl
+ dnl check for python
+ dnl
+-
+-PYTHON_VERSION=
+-PYTHON_INCLUDES=
+-PYTHON_SITE_PACKAGES=
+-PYTHON_TESTS=
+-pythondir=
+-if test "$with_python" != "no" ; then
+-    if test -x "$with_python/bin/python"
+-    then
+-        echo Found python in $with_python/bin/python
+-        PYTHON="$with_python/bin/python"
+-    else
+-	if test -x "$with_python"
+-	then
+-	    echo Found python in $with_python
+-	    PYTHON="$with_python"
+-	else
+-	    if test -x "$PYTHON"
+-	    then
+-	        echo Found python in environment PYTHON=$PYTHON
+-	    else
+-		AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+-	    fi
+-	fi
+-    fi
+-    if test "$PYTHON" != ""
+-    then
+-        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+-	echo Found Python version $PYTHON_VERSION
+-    fi
+-    if test "$PYTHON_VERSION" != ""
+-    then
+-	if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
+-	   -d $with_python/lib/python$PYTHON_VERSION/site-packages
+-	then
+-	    PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
+-	    PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
+-	else
+-	    if test -r $prefix/include/python$PYTHON_VERSION/Python.h
+-	    then
+-	        PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
+-		PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+-	    else
+-		if test -r /usr/include/python$PYTHON_VERSION/Python.h
+-		then
+-		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
+-		    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+-		else
+-		    echo could not find python$PYTHON_VERSION/Python.h
+-		fi
+-	    fi
+-	    if test ! -d "$PYTHON_SITE_PACKAGES"
+-	    then
+-		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
+-	    fi
+-	fi
+-    fi
+-    if test "$with_python" != ""
+-    then
+-        pythondir='$(PYTHON_SITE_PACKAGES)'
++if test x$with_python = xno ; then
++    AC_MSG_NOTICE([Python turned off])
++    have_python=no
++else
++dnl use the specified Python executable if it exists
++    if test -x "$with_python"; then
++        PYTHON="$with_python"
++    fi
++dnl go looking for another Python executable
++dnl this macro honors "PYTHON" if already defined
++    AM_PATH_PYTHON()
++    if test -z $PYTHON_VERSION; then
++	AC_MSG_WARN([Python not found])
++	have_python=no
+     else
+-        pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
++dnl check for Python headers
++	AM_CHECK_PYTHON_HEADERS(have_python=yes,have_python=no)
+     fi
+-else
+-    PYTHON=
+ fi
+-AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
+-if test "$PYTHON_INCLUDES" != ""
+-then
++AM_CONDITIONAL(WITH_PYTHON, test x$have_python = xyes)
++if test x$have_python = xyes; then
+     PYTHON_SUBDIR=python
+ else
+     PYTHON_SUBDIR=
+ fi
+-AC_SUBST(pythondir)
+ AC_SUBST(PYTHON_SUBDIR)
+ 
+ dnl check for dso support
+diff -Npru libxml2-2.6.22.orig/python/Makefile.am libxml2-2.6.22/python/Makefile.am
+--- libxml2-2.6.22.orig/python/Makefile.am	2005-01-01 09:49:02.000000000 -0700
++++ libxml2-2.6.22/python/Makefile.am	2006-01-01 21:24:52.000000000 -0700
+@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign
+ SUBDIRS= . tests
+ 
+ INCLUDES = \
+-	-I$(PYTHON_INCLUDES) \
++	$(PYTHON_INCLUDES) \
+ 	-I$(top_srcdir)/include	\
+ 	-I$(top_builddir)/include \
+ 	-I$(top_builddir)/$(subdir)
diff -Npru libxml2.orig/Makefile libxml2/Makefile
--- libxml2.orig/Makefile	2005-11-13 16:25:47.000000000 -0700
+++ libxml2/Makefile	2006-01-09 08:24:00.000000000 -0700
@@ -2,6 +2,7 @@ GARNAME = libxml2
 GARVERSION = 2.6.22
 CATEGORIES = platform
 DISTFILES = $(GARNAME)-$(GARVERSION).tar.bz2 buildDocBookCatalog
+PATCHFILES= python-path-fixes.diff
 
 DESCRIPTION = libxml2
 define BLURB
@@ -16,6 +17,10 @@ CONFIGURE_ARGS = $(DIRPATHS)
 
 include ../category.mk
 
+pre-configure:
+	@cd $(WORKSRC) && autoreconf
+	@$(MAKECOOKIE)
+
 post-install:
 	@$(FILEDIR)/buildDocBookCatalog $(sysconfdir) $(sharedstatedir)
 	@$(MAKECOOKIE)


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