Commit fd7f8eef authored by Martin Pitt's avatar Martin Pitt
Browse files

Fix building with --disable-cairo

Build gobject-introspection's regress.c against cairo, not pycairo/py3cairo. We
always need cairo to build, so unconditionally check for this in configure.ac.

In test_everything.py, gracefully handle the absence of the "cairo" Python
module, which we do not have when building without cairo support.
parent 1c5634e6
......@@ -184,6 +184,9 @@ AC_SUBST(LIBFFI_PC)
dnl gio
PKG_CHECK_MODULES(GIO, gio-2.0 >= gio_required_version)
# we always need cairo (not pycairo) for building the tests
PKG_CHECK_MODULES(CAIRO, cairo)
AC_ARG_ENABLE(cairo,
AC_HELP_STRING([--enable-cairo], [Enable Cairo bindings using introspection information]),
enable_cairo=$enableval,
......
......@@ -2,8 +2,8 @@ CLEANFILES =
noinst_LTLIBRARIES = libregress.la libgimarshallingtests.la
nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
libregress_la_CFLAGS = $(GIO_CFLAGS) $(PYCAIRO_CFLAGS)
libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(PYCAIRO_LIBS)
libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS)
nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS)
......
......@@ -9,7 +9,11 @@ sys.path.insert(0, "../")
from sys import getrefcount
import copy
import cairo
try:
import cairo
has_cairo = True
except ImportError:
has_cairo = False
from gi.repository import GObject
from gi.repository import GLib
......@@ -25,6 +29,7 @@ else:
class TestEverything(unittest.TestCase):
@unittest.skipUnless(has_cairo, 'built without cairo support')
def test_cairo_context(self):
context = Everything.test_cairo_context_full_return()
self.assertTrue(isinstance(context, cairo.Context))
......@@ -33,6 +38,7 @@ class TestEverything(unittest.TestCase):
context = cairo.Context(surface)
Everything.test_cairo_context_none_in(context)
@unittest.skipUnless(has_cairo, 'built without cairo support')
def test_cairo_surface(self):
surface = Everything.test_cairo_surface_none_return()
self.assertTrue(isinstance(surface, cairo.ImageSurface))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment