--enable-introspection=yes
SUBDIRS = libsignon-glib docs tests
+if ENABLE_PYTHON
+SUBDIRS += pygobject
+endif
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libsignon-glib.pc
gtkdocize
+automake --add-missing
autoreconf -i --force && ./configure "$@"
CFLAGS="$CFLAGS -g -fprofile-arcs -ftest-coverage"
fi
+AM_PATH_PYTHON
+
+PYGOBJECT_REQUIRED=2.90
+
+AC_ARG_ENABLE([python],
+ AS_HELP_STRING([--enable-python[=@<:@no/auto/yes@:>@]],[Build with python support]),
+ [enable_python=$enableval],
+ [enable_python="auto"])
+
+if test "x$enable_python" = "xauto"; then
+ PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
+ [enable_python=yes],[enable_python=no])
+fi
+
+if test "x$enable_python" = "xyes"; then
+ PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
+
+ pyoverridesdir=`$PYTHON -c "import gi;print gi._overridesdir"`
+ AC_SUBST(pyoverridesdir)
+fi
+
+AM_CONDITIONAL(ENABLE_PYTHON, test x"$enable_python" = "xyes")
+
AC_OUTPUT([
Makefile
libsignon-glib/Makefile
docs/Makefile
docs/reference/Makefile
tests/Makefile
+ pygobject/Makefile
])
--- /dev/null
+overridesdir = $(pyoverridesdir)
+overrides_PYTHON = \
+ Signon.py
+
--- /dev/null
+from ..overrides import override
+from ..importer import modules
+from gi.repository import GObject
+
+Signon = modules['Signon']._introspection_module
+
+__all__ = []
+
+class GStrv(list):
+ __gtype__ = GObject.type_from_name('GStrv')
+
+class AuthSession(Signon.AuthSession):
+
+ # Convert list of strings into a single string
+ def process(self, session_data, mechanism, callback, userdata):
+ cleaned_data = {}
+ for (key, value) in session_data.iteritems():
+ if isinstance(value, list):
+ cleaned_data[key] = GStrv(value)
+ else:
+ cleaned_data[key] = value
+ Signon.AuthSession.process(self, cleaned_data, mechanism, callback, userdata)
+
+AuthSession = override(AuthSession)
+__all__.append('AuthSession')
+