[gom] python: Prepare for adding some GI overrides
- From: Mathieu Bridon <mbridon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gom] python: Prepare for adding some GI overrides
- Date: Sat, 8 Aug 2015 12:14:20 +0000 (UTC)
commit d3dac3f409ed381120aa2445b13a0d0ecae93503
Author: Mathieu Bridon <bochecha daitauha fr>
Date: Sat Aug 1 16:26:55 2015 +0200
python: Prepare for adding some GI overrides
This adds an optional build-time dependency on Python 3 and PyGObject.
https://bugzilla.gnome.org/show_bug.cgi?id=753137
.gitignore | 1 +
Makefile.am | 1 +
bindings/python/Makefile.include | 4 ++++
bindings/python/gi/overrides/Gom.py | 22 ++++++++++++++++++++++
configure.ac | 27 +++++++++++++++++++++++++++
5 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 4b3a1dc..a96b71a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ Makefile.in
missing
*.o
*.pc
+py-compile
stamp-h1
*.swp
test-gom-adapter
diff --git a/Makefile.am b/Makefile.am
index e102598..e793b0b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
include Makefile.tests
+include bindings/python/Makefile.include
include data/Makefile.include
include examples/Makefile.include
include gom/Makefile.include
diff --git a/bindings/python/Makefile.include b/bindings/python/Makefile.include
new file mode 100644
index 0000000..37a480f
--- /dev/null
+++ b/bindings/python/Makefile.include
@@ -0,0 +1,4 @@
+if ENABLE_PYTHON
+overridesdir = $(pyoverridesdir)
+overrides_PYTHON = bindings/python/gi/overrides/Gom.py
+endif
diff --git a/bindings/python/gi/overrides/Gom.py b/bindings/python/gi/overrides/Gom.py
new file mode 100644
index 0000000..c89a125
--- /dev/null
+++ b/bindings/python/gi/overrides/Gom.py
@@ -0,0 +1,22 @@
+# Gom.py
+#
+# Copyright (C) 2015 Mathieu Bridon <bochecha daitauha fr>
+#
+# This file is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+from ..module import get_introspection_module
+
+
+Gom = get_introspection_module('Gom')
diff --git a/configure.ac b/configure.ac
index b2e6e6a..5a3f84c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,33 @@ dnl Miscellaneous
dnl **************************************************************************
GOBJECT_INTROSPECTION_CHECK([1.30.0])
+AC_ARG_ENABLE(python,
+ AS_HELP_STRING([--enable-python], [Enable introspection overrides for Python]),
+ [enable_python=$enableval],
+ [enable_python=auto])
+
+if test "x$enable_python" = "xno"; then
+ found_python="no"
+else
+ AM_PATH_PYTHON([3.4],, [:])
+ if test "x$PYTHON" = "x:"; then
+ found_python="no"
+ else
+ PKG_CHECK_MODULES(pygobject, [pygobject-3.0 >= 3.16.0], [
+ found_python="yes"
+ pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
+ AC_SUBST(pyoverridesdir)
+ ], [
+ found_python="no"
+ ])
+ fi
+fi
+
+if test "x$enable_python" = "xyes" -a "x$found_python" != "xyes"; then
+ AC_MSG_ERROR([You need to have Python 3 and PyGObject installed])
+fi
+
+AM_CONDITIONAL([ENABLE_PYTHON],[test "x$found_python" = "xyes"])
dnl **************************************************************************
dnl Output
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]