~registry/libsignon-glib/packaging

« back to all changes in this revision

Viewing changes to debian/patches/gi_override.patch

  • Committer: Ken VanDine
  • Date: 2012-07-25 19:18:24 UTC
  • mfrom: (131.1.6 libsignon-glib)
  • Revision ID: ken.vandine@canonical.com-20120725191824-tz2xw0xdv7re2joe
Tags: 1.3-0precise1
releasing version 1.3-0precise1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'Makefile.am'
 
2
--- old/Makefile.am     2012-07-25 18:39:07 +0000
 
3
+++ new/Makefile.am     2011-12-21 07:46:11 +0000
 
4
@@ -4,6 +4,10 @@
 
5
        --enable-introspection=yes
 
6
 SUBDIRS = libsignon-glib docs tests
 
7
 
 
8
+if ENABLE_PYTHON
 
9
+SUBDIRS += pygobject
 
10
+endif
 
11
+
 
12
 pkgconfigdir = $(libdir)/pkgconfig
 
13
 pkgconfig_DATA = libsignon-glib.pc
 
14
 
 
15
 
 
16
=== modified file 'configure.ac'
 
17
--- old/configure.ac    2012-07-25 18:39:07 +0000
 
18
+++ new/configure.ac    2012-04-16 06:25:06 +0000
 
19
@@ -59,6 +59,29 @@
 
20
 AC_SUBST(DBUS_CFLAGS)
 
21
 AC_SUBST(DBUS_LIBS)
 
22
 
 
23
+AM_PATH_PYTHON
 
24
+
 
25
+PYGOBJECT_REQUIRED=2.90
 
26
+
 
27
+AC_ARG_ENABLE([python],
 
28
+              AS_HELP_STRING([--enable-python[=@<:@no/auto/yes@:>@]],[Build with python support]),
 
29
+              [enable_python=$enableval],
 
30
+              [enable_python="auto"])
 
31
+
 
32
+if test "x$enable_python" = "xauto"; then
 
33
+    PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
 
34
+                    [enable_python=yes],[enable_python=no])
 
35
+fi
 
36
+
 
37
+if test "x$enable_python" = "xyes"; then
 
38
+    PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
 
39
+
 
40
+    pyoverridesdir=`$PYTHON -c "import gi;print gi._overridesdir"`
 
41
+    AC_SUBST(pyoverridesdir)
 
42
+fi
 
43
+
 
44
+AM_CONDITIONAL(ENABLE_PYTHON, test x"$enable_python" = "xyes")
 
45
+
 
46
 AC_OUTPUT([
 
47
        Makefile
 
48
        libsignon-glib/Makefile
 
49
@@ -66,4 +89,5 @@
 
50
        docs/Makefile
 
51
        docs/reference/Makefile
 
52
        tests/Makefile
 
53
+       pygobject/Makefile
 
54
 ])
 
55
 
 
56
=== added directory 'pygobject'
 
57
=== added file 'pygobject/Makefile.am'
 
58
--- old/pygobject/Makefile.am   1970-01-01 00:00:00 +0000
 
59
+++ new/pygobject/Makefile.am   2011-12-21 07:46:11 +0000
 
60
@@ -0,0 +1,4 @@
 
61
+overridesdir = $(pyoverridesdir)
 
62
+overrides_PYTHON = \
 
63
+       Signon.py
 
64
+
 
65
 
 
66
=== added file 'pygobject/Signon.py'
 
67
--- old/pygobject/Signon.py     1970-01-01 00:00:00 +0000
 
68
+++ new/pygobject/Signon.py     2012-01-20 10:35:45 +0000
 
69
@@ -0,0 +1,27 @@
 
70
+from ..overrides import override
 
71
+from ..importer import modules
 
72
+from gi.repository import GObject
 
73
+
 
74
+Signon = modules['Signon']._introspection_module
 
75
+
 
76
+__all__ = []
 
77
+
 
78
+class GStrv(list):
 
79
+    __gtype__ = GObject.type_from_name('GStrv')
 
80
+
 
81
+class AuthSession(Signon.AuthSession):
 
82
+
 
83
+    # Convert list of strings into a single string
 
84
+    def process(self, session_data, mechanism, callback, userdata):
 
85
+        cleaned_data = {}
 
86
+        for (key, value) in session_data.iteritems():
 
87
+            if isinstance(value, list):
 
88
+                cleaned_data[key] = GStrv(value)
 
89
+            else:
 
90
+                cleaned_data[key] = value
 
91
+        Signon.AuthSession.process(self, cleaned_data, mechanism, callback, userdata)
 
92
+
 
93
+AuthSession = override(AuthSession)
 
94
+__all__.append('AuthSession')
 
95
+
 
96
+
 
97