]> granicus.if.org Git - graphviz/commitdiff
trying to get python bindings to work on ubuntu9
authorellson <devnull@localhost>
Thu, 11 Jun 2009 15:18:18 +0000 (15:18 +0000)
committerellson <devnull@localhost>
Thu, 11 Jun 2009 15:18:18 +0000 (15:18 +0000)
configure.ac
debian/libgv-python.install
debian/rules
tclpkg/gv/Makefile.am

index 36fb827268da3d7644bde02accab5e6e12ec36fc..559719fc5de6e0cba833527c2a00137239dff284 100644 (file)
@@ -1294,6 +1294,70 @@ else
 fi
 AM_CONDITIONAL(WITH_PYTHON25, [test "x$use_python25" = "xYes"])
 
+dnl -----------------------------------
+dnl INCLUDES and LIBS for PYTHON26
+
+AC_ARG_ENABLE(python26,
+  [AS_HELP_STRING([--enable-python26=no],[python26 language bindings])],
+  [], [enable_python26=no])
+
+if test "x$enable_python26" != "xyes"; then
+  use_python26="No (disabled by default - for multiversion installs)"
+else
+  if test "x$use_swig" != "xYes"; then
+    use_python26="No (swig not available)"
+  else
+    if test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0; then
+      use_python26="No (swig does not support -python option)"
+    else
+      AC_CHECK_PROG(PYTHON26,python2.6,python2.6)
+      if test "x$PYTHON26" = "x"; then
+        use_python26="No (python26 not available)"
+      else
+        PYTHON26_VERSION=`$PYTHON26 -V 2>&1 | $GREP Python | cut -d ' ' -f 2`
+        if test "x$PYTHON26_VERSION" = "x"; then
+          PYTHON26=
+        else
+          PYTHON26_VERSION_MAJOR=`echo $PYTHON26_VERSION | cut -d '.' -f 1`
+          PYTHON26_VERSION_MINOR=`echo $PYTHON26_VERSION | cut -d '.' -f 2`
+          PYTHON26_VERSION_SHORT=$PYTHON26_VERSION_MAJOR.$PYTHON26_VERSION_MINOR
+          if test $PYTHON26_VERSION_MAJOR -lt 3; then
+            if test $PYTHON26_VERSION_MAJOR -lt 2; then
+             PYTHON26=
+            else
+              if test $PYTHON26_VERSION_MINOR -lt 5; then
+               PYTHON26=
+              fi
+            fi
+          fi
+        fi
+      fi
+      if test "x$PYTHON26" = "x"; then
+       use_python26="No (python2.6 is too old)"
+      else
+        PYTHON26_PREFIX=`$PYTHON26 -c "import sys; print sys.prefix"`
+        PYTHON26_INCLUDES=-I$PYTHON26_PREFIX/include/python$PYTHON26_VERSION_SHORT
+        PYTHON24_LIBS="-lpython$PYTHON_VERSION_SHORT"
+        PYTHON26_INSTALL_DIR="`$PYTHON26 $srcdir/config/config_python.py archsitelib`"
+        save_CPPFLAGS=$CPPFLAGS
+        CPPFLAGS="$CPPFLAGS $PYTHON26_INCLUDES"
+        AC_CHECK_HEADER(Python.h,,[
+          use_python26="No (missing header)"
+          PYTHON26=
+        ])
+        CPPFLAGS=$save_CPPFLAGS
+       if test "x$PYTHON26" != "x"; then
+         use_python26="Yes"
+          AC_SUBST(PYTHON26_INSTALL_DIR)
+          AC_SUBST(PYTHON26_INCLUDES)
+          AC_SUBST(PYTHON26_LIBS)
+        fi
+      fi
+    fi
+  fi
+fi
+AM_CONDITIONAL(WITH_PYTHON26, [test "x$use_python26" = "xYes"])
+
 dnl -----------------------------------
 dnl INCLUDES and LIBS for R
 
@@ -3142,6 +3206,7 @@ echo "  gv_python:     $use_python"
 echo "  gv_python23:   $use_python23"
 echo "  gv_python24:   $use_python24"
 echo "  gv_python25:   $use_python25"
+echo "  gv_python26:   $use_python26"
 echo "  gv_R:          $use_r"
 echo "  gv_ruby:       $use_ruby"
 echo "  gv_tcl:        $use_gv_tcl"
index d2a4b37d5deed2a364890cf22891ca4f491c00ed..73b61f019814a1c2d9d28309fcc249478a11d011 100644 (file)
@@ -1,4 +1,5 @@
 usr/lib/graphviz/python
-usr/lib/graphviz/python24
+#usr/lib/graphviz/python24
 usr/lib/graphviz/python25
+usr/lib/graphviz/python26
 usr/share/man/man3/gv.3python
index ff0195964ac9d53e44842e6802eaac1eb5c579d8..06f107c04796ea30a399440467edcb8378df3a38 100644 (file)
@@ -76,7 +76,8 @@ configure-stamp:
        --enable-python \
        --disable-python23 \
        --disable-python24 \
-       --disable-python25 \
+       --enable-python25 \
+       --enable-python26 \
        --disable-r \
        --enable-ruby \
        --enable-tcl \
index a640383f1b687db9a6ee626ae9cf46ebc2a1862f..9aa09c6c0fc4d04a950ec08d41c54dc517750283 100644 (file)
@@ -155,25 +155,48 @@ gv_python.cpp: gv.i
        $(SWIG) -c++ -python -o gv_python.cpp $(srcdir)/gv.i
 
 pkgpython23dir = $(pkglibdir)/python23
-nodist_libgv_python23_la_SOURCES = $(nodist_libgv_python_la_SOURCES)
+PYTHON23_data = gv.py
+nodist_libgv_python23_la_SOURCES = gv_python23.cpp $(PYTHON23_data)
 libgv_python23_la_SOURCES = $(BASESOURCES) gv_dummy_init.c
 libgv_python23_la_LIBADD = $(BASELIBS) $(PYTHON23_LIBS)
 libgv_python23_la_LDFLAGS = -module -avoid-version
 libgv_python23_la_CPPFLAGS = $(BASECPPFLAGS) $(PYTHON23_INCLUDES)
+# $(PYTHON23_data): gv_python.cpp
+gv_python23.cpp: gv.i
+       $(SWIG) -c++ -python -classic -o gv_python23.cpp $(srcdir)/gv.i
 
 pkgpython24dir = $(pkglibdir)/python24
-nodist_libgv_python24_la_SOURCES = $(nodist_libgv_python_la_SOURCES)
+PYTHON24_data = gv.py
+nodist_libgv_python24_la_SOURCES = gv_python24.cpp $(PYTHON24_data)
 libgv_python24_la_SOURCES = $(BASESOURCES) gv_dummy_init.c
 libgv_python24_la_LIBADD = $(BASELIBS) $(PYTHON24_LIBS)
 libgv_python24_la_LDFLAGS = -module -avoid-version
 libgv_python24_la_CPPFLAGS = $(BASECPPFLAGS) $(PYTHON24_INCLUDES)
+# $(PYTHON_data): gv_python.cpp
+gv_python24.cpp: gv.i
+       $(SWIG) -c++ -python -classic -o gv_python24.cpp $(srcdir)/gv.i
 
 pkgpython25dir = $(pkglibdir)/python25
-nodist_libgv_python25_la_SOURCES = $(nodist_libgv_python_la_SOURCES)
+PYTHON25_data = gv.py
+nodist_libgv_python25_la_SOURCES = gv_python25.cpp $(PYTHON25_data)
 libgv_python25_la_SOURCES = $(BASESOURCES) gv_dummy_init.c
 libgv_python25_la_LIBADD = $(BASELIBS) $(PYTHON25_LIBS)
 libgv_python25_la_LDFLAGS = -module -avoid-version
 libgv_python25_la_CPPFLAGS = $(BASECPPFLAGS) $(PYTHON25_INCLUDES)
+# $(PYTHON_data): gv_python.cpp
+gv_python25.cpp: gv.i
+       $(SWIG) -c++ -python -o gv_python25.cpp $(srcdir)/gv.i
+
+pkgpython26dir = $(pkglibdir)/python26
+PYTHON26_data = gv.py
+nodist_libgv_python26_la_SOURCES = gv_python26.cpp $(PYTHON26_data)
+libgv_python26_la_SOURCES = $(BASESOURCES) gv_dummy_init.c
+libgv_python26_la_LIBADD = $(BASELIBS) $(PYTHON26_LIBS)
+libgv_python26_la_LDFLAGS = -module -avoid-version
+libgv_python26_la_CPPFLAGS = $(BASECPPFLAGS) $(PYTHON26_INCLUDES)
+# $(PYTHON_data): gv_python.cpp
+gv_python26.cpp: gv.i
+       $(SWIG) -c++ -python -o gv_python26.cpp $(srcdir)/gv.i
 
 pkgRdir = $(pkglibdir)/R
 R_data = 
@@ -298,6 +321,13 @@ pdf_DATA += gv.3python.pdf
 pkgpython25_LTLIBRARIES = libgv_python25.la
 #DEVTSTS += test_python25
 endif
+if WITH_PYTHON26
+pkgpython26_DATA = $(PYTHON26_data)
+man_MANS += gv.3python
+pdf_DATA += gv.3python.pdf
+pkgpython26_LTLIBRARIES = libgv_python26.la
+#DEVTSTS += test_python26
+endif
 if WITH_R
 pkgR_DATA = $(R_data)
 man_MANS += gv.3r
@@ -395,6 +425,9 @@ endif
 if WITH_PYTHON25
        (cd $(DESTDIR)$(pkgpython25dir); rm -f _gv.so; $(LN_S) libgv_python25.so _gv.so;)
 endif
+if WITH_PYTHON26
+       (cd $(DESTDIR)$(pkgpython26dir); rm -f _gv.so; $(LN_S) libgv_python26.so _gv.so;)
+endif
 if WITH_R
        (cd $(DESTDIR)$(pkgRdir);   rm -f gv.so;  $(LN_S) libgv_R.so gv.so;)
 endif
@@ -413,6 +446,7 @@ uninstall-hook:
        rm -rf $(DESTDIR)$(pkgpython23dir);
        rm -rf $(DESTDIR)$(pkgpython24dir);
        rm -rf $(DESTDIR)$(pkgpython25dir);
+       rm -rf $(DESTDIR)$(pkgpython26dir);
        rm -rf $(DESTDIR)$(pkgRdir);
        rm -rf $(DESTDIR)$(pkgrubydir);
        rm -rf $(DESTDIR)$(pkgtcldir);
@@ -523,6 +557,7 @@ CLEANFILES = test_*/* pkgIndex.tcl \
        gv_python23.cpp $(PYTHON23_data) gv.pyc \
        gv_python24.cpp $(PYTHON24_data) gv.pyc \
        gv_python25.cpp $(PYTHON25_data) gv.pyc \
+       gv_python26.cpp $(PYTHON26_data) gv.pyc \
        gv_R.cpp $(R_data) \
        gv_ruby.cpp $(RUBY_data) \
        gv_tcl.cpp $(TCL_data) pkgIndex.tcl