[Xapian-devel] Patch to enable python bindings in absence of docs build

James Aylett james-xapian at tartarus.org
Mon Jun 4 17:00:47 BST 2007


As discussed on IRC. The naming conventions aren't ideal, but the
intent feels right and it works for me.

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org
-------------- next part --------------
Index: python/util.i
===================================================================
--- python/util.i	(revision 8794)
+++ python/util.i	(working copy)
@@ -25,7 +25,9 @@
 %}
 
 /* Include the documentation comments extracted from doxygen output. */
+#ifdef DOCCOMMENTS_I_SOURCES
 %include "doccomments.i"
+#endif
 
 /* Include overrides for the documentation comments. */
 %include "extracomments.i"
Index: python/Makefile.am
===================================================================
--- python/Makefile.am	(revision 8794)
+++ python/Makefile.am	(working copy)
@@ -9,7 +9,12 @@
 
 BUILT_SOURCES = modern/xapian_wrap.cc modern/xapian_wrap.h modern/xapian.py
 
-EXTRA_DIST = util.i extra.i extracomments.i except.i doccomments.i\
+if HAVE_DOCCOMMENTS_SOURCES
+DOCCOMMENTS_I = doccomments.i
+DOCCOMMENTS_I_FLAGS=-DDOCCOMMENTS_I_SOURCES
+endif
+
+EXTRA_DIST = util.i extra.i extracomments.i except.i $(DOCCOMMENTS_I)\
 	testsuite.py $(TESTS) $(BUILT_SOURCES)
 
 SUBDIRS = docs
@@ -58,7 +63,7 @@
 # "\" when extracting the output directory from the value passed to the -o
 # option.
 
-BUILT_SOURCES += except.i doccomments.i
+BUILT_SOURCES += except.i $(DOCCOMMENTS_I)
 except.i: generate-python-exceptions ../../xapian-core/exception_data.pm
 	./generate-python-exceptions
 
@@ -79,9 +84,9 @@
 	    test -f modern/xapian_wrap.stamp; exit $$?; \
 	  fi; \
 	fi
-modern/xapian_wrap.stamp: $(SWIG_sources) util.i except.i doccomments.i extra.i extracomments.i
+modern/xapian_wrap.stamp: $(SWIG_sources) util.i except.i $(DOCCOMMENTS_I) extra.i extracomments.i
 	test -d modern || mkdir modern
-	$(SWIG) $(SWIG_includes) $(SWIG_FLAGS) -c++ \
+	$(SWIG) $(SWIG_includes) $(SWIG_FLAGS) $(DOCCOMMENTS_I_FLAGS) -c++ \
 	    -python -threads -shadow -modern -O -outdir modern \
 	    -o modern/xapian_wrap.cc $(SWIG_mainsource)
 	$(PERL) -pe 's/class Error:/class Error(Exception):/' modern/xapian.py > modern/xapian_py.tmp
Index: configure.ac
===================================================================
--- configure.ac	(revision 8794)
+++ configure.ac	(working copy)
@@ -99,6 +99,10 @@
 test -n "$docdir" || docdir='${datadir}/doc/${PACKAGE_TARNAME}'
 AC_SUBST(docdir)
 
+dnl Try to find the xapian-core files used to build python/doccomments.i;
+dnl this is optional (it's nicer if we do this, but not essential).
+AM_CONDITIONAL(HAVE_DOCCOMMENTS_SOURCES, test -f ${srcdir}../../xapian-core/docs/apidoc/xml/index.xml)
+
 dnl Only probe for SWIG and enable SWIG rules in makefiles if
 dnl configure --enable-maintainer-mode is used.
 AM_MAINTAINER_MODE


More information about the Xapian-devel mailing list