summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2010-04-12 23:21:24 -0400
committerJohn Ehresman <jpe@wingware.com>2010-04-15 12:13:34 -0400
commitf6f2ed44c84aff3c38fc3eb5961b28621a14fc51 (patch)
tree20d33d2b2dc36a454ba8ad9e59b823b50569e3a8
parentd8109d9de81a776794965d4cc1093ca03bebd6af (diff)
downloadpygobject-f6f2ed44c84aff3c38fc3eb5961b28621a14fc51.tar.gz
pygobject-f6f2ed44c84aff3c38fc3eb5961b28621a14fc51.tar.xz
pygobject-f6f2ed44c84aff3c38fc3eb5961b28621a14fc51.zip
Make pyglib-python-compat.h a public header and include in pygobject.h Also #define PyVarObject_HEAD_INIT if not defined (in < python 2.6)
-rwxr-xr-xcodegen/codegen.py2
-rw-r--r--glib/Makefile.am4
-rw-r--r--glib/pyglib-private.h2
-rw-r--r--glib/pyglib-python-compat.h7
-rw-r--r--glib/pyglib.h2
-rw-r--r--gobject/pygobject.h2
-rw-r--r--tests/Makefile.am1
7 files changed, 16 insertions, 4 deletions
diff --git a/codegen/codegen.py b/codegen/codegen.py
index 7a1f7e6..aef93ae 100755
--- a/codegen/codegen.py
+++ b/codegen/codegen.py
@@ -96,7 +96,7 @@ class FileOutput:
class Wrapper:
type_tmpl = (
'PyTypeObject G_GNUC_INTERNAL Py%(typename)s_Type = {\n'
- ' PyVarObject_HEAD_INIT(NULL, 0)'
+ ' PyVarObject_HEAD_INIT(NULL, 0)\n'
' "%(classname)s", /* tp_name */\n'
' sizeof(%(tp_basicsize)s), /* tp_basicsize */\n'
' 0, /* tp_itemsize */\n'
diff --git a/glib/Makefile.am b/glib/Makefile.am
index d230da4..b249332 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -2,7 +2,9 @@ AUTOMAKE_OPTIONS = 1.7
INCLUDES = $(PYTHON_INCLUDES) $(GLIB_CFLAGS) -DPY_SSIZE_T_CLEAN
pkgincludedir = $(includedir)/pygtk-2.0
-pkginclude_HEADERS = pyglib.h
+pkginclude_HEADERS = \
+ pyglib.h \
+ pyglib-python-compat.h
lib_LTLIBRARIES = libpyglib-2.0-@PYTHON_BASENAME@.la
diff --git a/glib/pyglib-private.h b/glib/pyglib-private.h
index 8b033e1..c535fee 100644
--- a/glib/pyglib-private.h
+++ b/glib/pyglib-private.h
@@ -25,8 +25,6 @@
#include <Python.h>
#include <glib.h>
-#include <pyglib-python-compat.h>
-
G_BEGIN_DECLS
struct _PyGLib_Functions {
diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h
index 915a912..c2523ff 100644
--- a/glib/pyglib-python-compat.h
+++ b/glib/pyglib-python-compat.h
@@ -61,6 +61,13 @@ typedef inquiry lenfunc;
#define _PyLong_Type PyInt_Type
#define _PyLong_AS_LONG PyInt_AS_LONG
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+
+#ifndef PyVarObject_HEAD_INIT
+#define PyVarObject_HEAD_INIT(base, size) \
+ PyObject_HEAD_INIT(base) \
+ size,
+#endif
+
#else
#undef PYGLIB_MODULE_START
#undef PYGLIB_MODULE_END
diff --git a/glib/pyglib.h b/glib/pyglib.h
index 24e1ed2..62561e9 100644
--- a/glib/pyglib.h
+++ b/glib/pyglib.h
@@ -26,6 +26,8 @@
#include <glib.h>
+#include <pyglib-python-compat.h>
+
G_BEGIN_DECLS
typedef void (*PyGLibThreadsEnabledFunc) (void);
diff --git a/gobject/pygobject.h b/gobject/pygobject.h
index d7eba07..aaab860 100644
--- a/gobject/pygobject.h
+++ b/gobject/pygobject.h
@@ -7,6 +7,8 @@
#include <glib.h>
#include <glib-object.h>
+#include <pyglib.h>
+
G_BEGIN_DECLS
/* This is deprecated, don't use */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e546f50..70eeb5e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,6 @@
INCLUDES = \
-I$(top_srcdir)/gobject \
+ -I$(top_srcdir)/glib \
$(PYTHON_INCLUDES) \
$(GLIB_CFLAGS)