[pygobject] Allow building pygobject without introspection support by providing --disable-introspection to confi



commit 5f82e7d2909cbbbecbf5dbee2342f516c0d1f371
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Wed Jun 23 13:59:14 2010 +0200

    Allow building pygobject without introspection support by providing
    --disable-introspection to configure.

 Makefile.am             |    6 +++++-
 configure.ac            |   15 ++++++++-------
 gobject/pygi-external.h |    4 ++--
 tests/Makefile.am       |    8 ++++++--
 tests/runtests.py       |   21 +++++++--------------
 5 files changed, 28 insertions(+), 26 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index df47803..c5c6625 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,11 @@
 ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = 1.7
 
-SUBDIRS = docs codegen glib gobject gio gi examples tests
+SUBDIRS = docs codegen glib gobject gio examples tests
+
+if ENABLE_INTROSPECTION
+SUBDIRS += gi
+endif
 
 PLATFORM_VERSION = 2.0
 
diff --git a/configure.ac b/configure.ac
index 2c051d3..b55a6b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,7 +177,6 @@ if test x"$have_libffi" = xyes; then
   AC_DEFINE(HAVE_FFI_H,1,[Have libffi include files])
   LIBFFI_PC=libffi
 fi
-AC_MSG_RESULT([$have_libffi])
 AM_CONDITIONAL(HAVE_LIBFFI, test "$have_libffi" = "yes")
 AC_SUBST(FFI_CFLAGS)
 AC_SUBST(FFI_LIBS)
@@ -203,12 +202,12 @@ if test -n "$export_dynamic"; then
   GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"`
 fi
 
-AC_ARG_ENABLE(pygi,
-  AC_HELP_STRING([--enable-pygi], [Use PyGI to create wrappers for introspection-enabled types]),
-  enable_pygi=$enableval,
-  enable_pygi=no)
-if test "$enable_pygi" != no; then
-    AC_DEFINE(ENABLE_PYGI,1,Use PyGI to create wrappers for introspection-enabled types)
+AC_ARG_ENABLE(introspection,
+  AC_HELP_STRING([--enable-introspection], [Use introspection information]),
+  enable_introspection=$enableval,
+  enable_introspection=yes)
+if test "$enable_introspection" != no; then
+    AC_DEFINE(ENABLE_INTROSPECTION,1,Use introspection information)
     PKG_CHECK_MODULES(GI,
         glib-2.0 >= 2.22.4
         gobject-introspection-1.0 >= 0.6.14
@@ -216,6 +215,7 @@ if test "$enable_pygi" != no; then
         pycairo >= 1.0.2
     )
 fi
+AM_CONDITIONAL(ENABLE_INTROSPECTION, test "$enable_introspection" = "yes")
 
 INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
 INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
@@ -260,4 +260,5 @@ AC_OUTPUT
 
 echo
 echo "libffi support: $have_libffi"
+echo "introspection support: $enable_introspection"
 echo
diff --git a/gobject/pygi-external.h b/gobject/pygi-external.h
index b369dca..540ee91 100644
--- a/gobject/pygi-external.h
+++ b/gobject/pygi-external.h
@@ -17,7 +17,7 @@ static struct PyGI_API *PyGI_API = NULL;
 static int
 _pygi_import (void)
 {
-#if ENABLE_PYGI
+#if ENABLE_INTROSPECTION
     PyObject *module;
     PyObject *api;
 
@@ -52,7 +52,7 @@ _pygi_import (void)
     return 0;
 #else
     return -1;
-#endif /* ENABLE_PYGI */
+#endif /* ENABLE_INTROSPECTION */
 }
 
 static inline PyObject *
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3bb37eb..50770b2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,10 +33,14 @@ tests =  \
 	test_signal.py \
 	test_subprocess.py \
 	test_unknown.py \
-	test_source.py \
+	test_source.py
+
+if ENABLE_INTROSPECTION
+tests += \
 	test_everything.py \
 	test_gi.py \
 	test_overrides.py
+endif
 
 # This is a hack to make sure a shared library is built
 testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
@@ -48,7 +52,7 @@ check-local: $(top_srcdir)/glib/__init__.py $(top_srcdir)/gobject/__init__.py $(
 	   cp $(top_srcdir)/gobject/*.py $(top_builddir)/gobject; \
 	   cp $(top_srcdir)/gio/*.py $(top_builddir)/gio; \
 	fi
-	$(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir)
+	$(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir) $(tests)
 	@if test "$(top_builddir)" != "$(top_srcdir)"; then \
 	   rm -f $(top_builddir)/glib/*.py; \
 	   rm -f $(top_builddir)/gobject/*.py; \
diff --git a/tests/runtests.py b/tests/runtests.py
index da5ade0..1c67d05 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -7,29 +7,22 @@ import unittest
 import common
 
 program = None
-if len(sys.argv) == 3:
-    buildDir = sys.argv[1]
-    srcDir = sys.argv[2]
-else:
-    if len(sys.argv) == 2:
-        program = sys.argv[1]
-        if program.endswith('.py'):
-            program = program[:-3]
-    buildDir = '..'
-    srcDir = '.'
+if len(sys.argv) < 3:
+    raise ValueError('Need at least 3 parameters: runtests.py <build-dir> '
+                     '<src-dir> <test-module-1> <test-module-2> ...')
+
+buildDir = sys.argv[1]
+srcDir = sys.argv[2]
+files = sys.argv[3:]
 
 common.importModules(buildDir=buildDir,
                      srcDir=srcDir)
 
-SKIP_FILES = ['common', 'runtests']
-
 dir = os.path.split(os.path.abspath(__file__))[0]
 os.chdir(dir)
 
 def gettestnames():
-    files = glob.glob('*.py')
     names = map(lambda x: x[:-3], files)
-    map(names.remove, SKIP_FILES)
     return names
 
 suite = unittest.TestSuite()



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