[pybliographer/gtk3] build: Move modules dependency checking to configure.ac



commit e27efc68b7c151506c94c74d10a1ad2fb57a9f2d
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Fri Mar 21 14:37:17 2014 -0700

    build: Move modules dependency checking to configure.ac
    
    * Update checks to PyGi and Gtk
    * Use available macro to check for Python
    * Check for Python >= 2.6, which is the minimum verion
      required by PyGi

 Makefile.am         |    3 +-
 Pyblio/Makefile.am  |    1 -
 configure.ac        |   67 +++++++++++----------------
 scripts/Makefile.am |    1 -
 setup-check.py      |  124 ---------------------------------------------------
 5 files changed, 28 insertions(+), 168 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index c6b5792..821867a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,7 +59,7 @@ INTLTOOL =                    \
        intltool-merge.in       \
        intltool-update.in
 
-EXTRA_DIST =   setup-check.py                  \
+EXTRA_DIST = \
                pybliographer.in                \
                pybliographic.keys.in           \
                pybliographic.mime              \
@@ -82,7 +82,6 @@ pybliographer: pybliographer.in
                -e s!\ bin_dir\@!$(bindir)!               \
                -e s!\ libpyb\@!$(libdir)/$(PACKAGE)!     \
                -e s!\ datapyb\@!$(datadir)/$(PACKAGE)!   \
-               -e s!\ python_path\@!\ Python\@!          \
                -e s!\ package\@!$(PACKAGE)!              \
                -e s!\ version\@!$(VERSION)!              \
                -e s!\ locale_dir\@!$(localedir)!         \
diff --git a/Pyblio/Makefile.am b/Pyblio/Makefile.am
index 1d36b42..ee7c2e2 100644
--- a/Pyblio/Makefile.am
+++ b/Pyblio/Makefile.am
@@ -59,7 +59,6 @@ version.py: version.py.in
                -e s!\ bin_dir\@!$(bindir)!               \
                -e s!\ libpyb\@!$(libdir)/$(PACKAGE)!     \
                -e s!\ datapyb\@!$(datadir)/$(PACKAGE)!   \
-               -e s!\ python_path\@!\ Python\@!          \
                -e s!\ package\@!$(PACKAGE)!              \
                -e s!\ version\@!$(VERSION)!              \
                -e s!\ locale_dir\@!$(localedir)!         \
diff --git a/configure.ac b/configure.ac
index becd524..834c152 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,50 +31,37 @@ AC_CONFIG_SRCDIR(pybliographer.in)
 
 AC_PROG_LN_S
 
-AC_PATH_PROG(Python, python, no)
-
-if test "${Python}" = "no" ; then
-  AC_MSG_ERROR([please install python first])
-fi
-
-dnl Python version
-MINIMUM_VERSION="2.2"
+AM_PATH_PYTHON(2.6)
+PKG_CHECK_MODULES(PYBLIOGRAPHER, pygobject-3.0)
 
 # PACKAGERS
 AC_ARG_ENABLE([depchecks],
-   [AS_HELP_STRING([--disable-depchecks],
-      [skip dependency checks (while building packages for instance)])],
-   [],
-   [enable_depchecks=yes])
-
-AC_MSG_CHECKING([python requirements])
-
-if test ${enable_depchecks} = "yes" ; then
-
-${Python} ${srcdir}/setup-check.py ${MINIMUM_VERSION} 2>&5 1>&2
-
-result=$?
-
-if test -f conftest.out ; then
-       . ./conftest.out
-       rm -f conftest.out
-else
-       AC_MSG_RESULT([no])
-       AC_MSG_ERROR([unable to run the test program])
-fi
-
-if test $result = 0 ; then
-       if test -z "${Status}" ; then
-         AC_MSG_RESULT([yes (python ${Python_Version}, python-gtk ${PyGtk_Version})])
-        else
-          AC_MSG_RESULT([assuming yes (${Status})])
-        fi
-else
-       AC_MSG_RESULT([no])
-       AC_MSG_ERROR([${Status}])
-fi
+       [AS_HELP_STRING([--disable-depchecks],
+               [skip dependency checks (while building packages for instance)])],
+       [],
+       [enable_depchecks=yes])
+
+AC_MSG_CHECKING([for module requirements])
+if test x${enable_depchecks} = "xyes" ; then
+       # Check that recode and bibtex work as expected
+       ${PYTHON} -c "import _recode as r, sys
+sys.exit(not r.recode(r.request('latin1..latex'), 'abcd') == 'abcd')" 2>/dev/null
+       if test $? -ne 0; then
+               AC_MSG_ERROR([Broken recode version])
+       fi
+
+       ${PYTHON} -c "import _bibtex;_bibtex.next_unfiltered" 2>/dev/null
+       if test $? -ne 0; then
+               AC_MSG_ERROR([python-bibtex module required with function 'next_unfiltered'])
+       fi
+
+       ${PYTHON} -c "from gi.repository import Gtk" 2>/dev/null
+       if test $? -ne 0; then
+               AC_MSG_ERROR([Gtk+ 3 required])
+       fi
+       AC_MSG_RESULT([yes])
 else
-  AC_MSG_RESULT([disabled by user])
+       AC_MSG_RESULT([disabled by user])
 fi
 
 # i18n
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 56b9411..503b2a8 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -57,7 +57,6 @@ pybscript: pybscript.in
                -e s!\ bin_dir\@!$(bindir)!               \
                -e s!\ libpyb\@!$(libdir)/$(PACKAGE)!     \
                -e s!\ datapyb\@!$(datadir)/$(PACKAGE)!   \
-               -e s!\ python_path\@!\ Python\@!          \
                -e s!\ package\@!$(PACKAGE)!              \
                -e s!\ version\@!$(VERSION)!              \
                -e s!\ locale_dir\@!$(localedir)!         \


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