[pygobject] Merge gobject static code into the gi module



commit d3e8946dbb23197a2e9d7de351a7b9cd04d360b9
Author: Simon Feltman <sfeltman src gnome org>
Date:   Thu Oct 31 02:22:03 2013 -0700

    Merge gobject static code into the gi module
    
    Remove gi._gobject._gobject as a separately compiled static module and
    move all the files into gi._gi.
    Remove dead module initialization macros from "pyglib-python-compat.h"
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712197

 gi/Makefile.am                        |   31 +++++++++++++--
 gi/_glib/pyglib-python-compat.h       |   62 +++++++++---------------------
 gi/_gobject/Makefile.am               |   69 +--------------------------------
 gi/_gobject/__init__.py               |    4 +-
 gi/_gobject/constants.py              |    3 +-
 gi/_gobject/propertyhelper.py         |   16 +++++--
 gi/_gobject/signalhelper.py           |    3 +-
 gi/gimodule.c                         |   13 +++---
 gi/{_gobject => }/gobjectmodule.c     |    0
 gi/module.py                          |    4 +-
 gi/{_gobject => }/pygboxed.c          |    0
 gi/{_gobject => }/pygboxed.h          |    0
 gi/{_gobject => }/pygenum.c           |    0
 gi/{_gobject => }/pygenum.h           |    0
 gi/{_gobject => }/pygflags.c          |    0
 gi/{_gobject => }/pygflags.h          |    0
 gi/pygi-argument.c                    |    3 +-
 gi/pygi-boxed.c                       |    2 +-
 gi/pygi-ccallback.c                   |    2 +-
 gi/pygi-foreign.c                     |    2 +-
 gi/pygi-info.c                        |    2 +-
 gi/pygi-marshal-to-py.c               |    3 +-
 gi/pygi-private.h                     |    2 +-
 gi/pygi-source.c                      |    3 +-
 gi/pygi-struct.c                      |    2 +-
 gi/pygi.h                             |    3 +-
 gi/{_gobject => }/pyginterface.c      |    0
 gi/{_gobject => }/pyginterface.h      |    0
 gi/{_gobject => }/pygobject-private.h |    5 +-
 gi/{_gobject => }/pygobject.c         |    0
 gi/{_gobject => }/pygobject.h         |    0
 gi/{_gobject => }/pygparamspec.c      |    0
 gi/{_gobject => }/pygparamspec.h      |    2 +
 gi/{_gobject => }/pygpointer.c        |    0
 gi/{_gobject => }/pygpointer.h        |    0
 gi/{_gobject => }/pygtype.c           |    0
 gi/{_gobject => }/pygtype.h           |    0
 gi/types.py                           |    3 +-
 tests/Makefile.am                     |    2 +-
 39 files changed, 93 insertions(+), 148 deletions(-)
---
diff --git a/gi/Makefile.am b/gi/Makefile.am
index aa91a46..e4b1819 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -24,11 +24,32 @@ extension_ldflags += \
        -no-undefined
 endif
 
+pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION)
+pkginclude_HEADERS = pygobject.h
+
 pygidir = $(pyexecdir)/gi
 
 pygi_LTLIBRARIES = _gi.la
 
 _gi_la_SOURCES = \
+       gobjectmodule.c \
+       pygboxed.c \
+       pygboxed.h \
+       pygenum.c \
+       pygenum.h \
+       pygflags.c \
+       pygflags.h \
+       pyginterface.c \
+       pyginterface.h \
+       pygobject.c \
+       pygobject.h \
+       pygobject-private.h \
+       pygparamspec.c \
+       pygparamspec.h \
+       pygpointer.c \
+       pygpointer.h \
+       pygtype.c \
+       pygtype.h \
        pygi-repository.c \
        pygi-repository.h \
        pygi-info.c \
@@ -69,13 +90,16 @@ _gi_la_SOURCES = \
        pygi-marshal-cleanup.c \
        pygi-marshal-cleanup.h
 _gi_la_CFLAGS = \
+       $(extension_cppflags) \
+       -I$(top_srcdir)/gi/_glib \
+       $(GLIB_CFLAGS) \
        $(GI_CFLAGS)
 _gi_la_CPPFLAGS = \
        $(extension_cppflags) \
-       -I$(top_srcdir)/gi/_glib \
-       -I$(top_srcdir)/gi/_gobject
+       -I$(top_srcdir)/gi/_glib
 _gi_la_LIBADD = \
        $(extension_libadd) \
+       $(GLIB_LIBS) \
        $(GI_LIBS) \
        $(top_builddir)/gi/_glib/libpyglib-gi-2 0- PYTHON_BASENAME@.la
 _gi_la_LDFLAGS = \
@@ -93,8 +117,7 @@ _gi_cairo_la_CFLAGS = \
        $(PYCAIRO_CFLAGS)
 _gi_cairo_la_CPPFLAGS = \
        $(extension_cppflags) \
-       -I$(top_srcdir)/gi/_glib \
-       -I$(top_srcdir)/gi/_gobject
+       -I$(top_srcdir)/gi/_glib
 _gi_cairo_la_LIBADD = \
        $(extension_libadd) \
        $(GI_LIBS) \
diff --git a/gi/_glib/pyglib-python-compat.h b/gi/_glib/pyglib-python-compat.h
index 844bc55..5365b20 100644
--- a/gi/_glib/pyglib-python-compat.h
+++ b/gi/_glib/pyglib-python-compat.h
@@ -29,46 +29,6 @@
 # define PYGLIB_CPointer_Import(module, symbol) \
     PyCapsule_Import(##module##.##symbol##, FALSE)
 
-#if PY_VERSION_HEX < 0x03000000
-
-#define PYGLIB_INIT_FUNCTION(modname, fullpkgname, functions) \
-static int _pyglib_init_##modname(PyObject *module); \
-void init##modname(void) \
-{ \
-    PyObject *module = Py_InitModule(fullpkgname, functions); \
-    _pyglib_init_##modname(module); \
-} \
-static int _pyglib_init_##modname(PyObject *module)
-
-#else
-
-#define PYGLIB_INIT_FUNCTION(modname, fullpkgname, functions) \
-static struct PyModuleDef _##modname##module = {     \
-    PyModuleDef_HEAD_INIT,                              \
-    fullpkgname,                                        \
-    NULL,                                               \
-    -1,                                                 \
-    functions,                                          \
-    NULL,                                               \
-    NULL,                                               \
-    NULL,                                               \
-    NULL                                                \
-};                                                      \
-static int _pyglib_init_##modname(PyObject *module); \
-PyObject *PyInit_##modname(void) \
-{ \
-    PyObject *module = PyModule_Create(&_##modname##module);  \
-    if (module == NULL) \
-       return NULL; \
-    if (_pyglib_init_##modname(module) != 0 ) {\
-       Py_DECREF(module); \
-       return NULL; \
-    } \
-    return module; \
-} \
-static int _pyglib_init_##modname(PyObject *module)
-
-#endif
 
 /* Compilation on Python 2.x */
 #if PY_VERSION_HEX < 0x03000000
@@ -121,12 +81,18 @@ static int _pyglib_init_##modname(PyObject *module)
 #endif
 
 #define PYGLIB_MODULE_START(symbol, modname)           \
-DL_EXPORT(void) init##symbol(void); \
-DL_EXPORT(void) init##symbol(void)                     \
+PyObject * pyglib_##symbol##_module_create(void);       \
+DL_EXPORT(void) init##symbol(void);                     \
+DL_EXPORT(void) init##symbol(void) {                    \
+    pyglib_##symbol##_module_create();                  \
+};                                                      \
+PyObject * pyglib_##symbol##_module_create(void)        \
 {                                                       \
     PyObject *module;                                   \
     module = Py_InitModule(modname, symbol##_functions);
-#define PYGLIB_MODULE_END }
+
+#define PYGLIB_MODULE_END return module; }
+
 #define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol)  \
 PyTypeObject symbol = {                                 \
     PyObject_HEAD_INIT(NULL)                            \
@@ -135,6 +101,7 @@ PyTypeObject symbol = {                                 \
     sizeof(csymbol),                                    \
     0,                                                  \
 };
+
 #define PYGLIB_REGISTER_TYPE(d, type, name)            \
     if (!type.tp_alloc)                                 \
        type.tp_alloc = PyType_GenericAlloc;            \
@@ -160,18 +127,25 @@ PyTypeObject symbol = {                                 \
     NULL,                                               \
     NULL                                                \
 };                                                      \
+PyObject * pyglib_##symbol##_module_create(void);       \
 PyMODINIT_FUNC PyInit_##symbol(void);                   \
-PyMODINIT_FUNC PyInit_##symbol(void)                    \
+PyMODINIT_FUNC PyInit_##symbol(void) {                  \
+    return pyglib_##symbol##_module_create();           \
+};                                                      \
+PyObject * pyglib_##symbol##_module_create(void)        \
 {                                                       \
     PyObject *module;                                   \
     module = PyModule_Create(&_##symbol##module);
+
 #define PYGLIB_MODULE_END return module; }
+
 #define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol)  \
 PyTypeObject symbol = {                                 \
     PyVarObject_HEAD_INIT(NULL, 0)                      \
     typename,                                           \
     sizeof(csymbol)                                     \
 };
+
 #define PYGLIB_REGISTER_TYPE(d, type, name)                \
     if (!type.tp_alloc)                                 \
            type.tp_alloc = PyType_GenericAlloc;            \
diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am
index 5059ea7..b128acc 100644
--- a/gi/_gobject/Makefile.am
+++ b/gi/_gobject/Makefile.am
@@ -1,29 +1,6 @@
 AUTOMAKE_OPTIONS = 1.7
 PLATFORM_VERSION = 3.0
 
-pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION)
-pkginclude_HEADERS = pygobject.h
-
-extension_cppflags = \
-       $(PYTHON_INCLUDES) \
-       -DPY_SSIZE_T_CLEAN
-
-extension_ldflags = \
-       -module \
-       -avoid-version \
-       -shrext $(PYTHON_SO)
-
-if OS_WIN32
-# Windows requires Python modules to be explicitly linked to libpython.
-# Extension modules are shared libaries (.dll), but need to be
-# called .pyd for Python to load it as an extension module.
-extension_libadd = \
-       $(PYTHON_LIBS)
-
-extension_ldflags += \
-       -no-undefined
-endif
-
 pygobjectdir = $(pyexecdir)/gi/_gobject
 
 pygobject_PYTHON = \
@@ -32,44 +9,6 @@ pygobject_PYTHON = \
        propertyhelper.py \
        signalhelper.py
 
-pygobject_LTLIBRARIES = _gobject.la
-
-_gobject_la_SOURCES = \
-        gobjectmodule.c \
-        pygboxed.c \
-        pygboxed.h \
-        pygenum.c \
-        pygenum.h \
-        pygflags.c \
-        pygflags.h \
-        pyginterface.c \
-        pyginterface.h \
-        pygobject.c \
-        pygobject.h \
-        pygobject-private.h \
-        pygparamspec.c \
-        pygparamspec.h \
-        pygpointer.c \
-        pygpointer.h \
-        pygtype.c \
-        pygtype.h
-_gobject_la_CFLAGS = \
-       $(extension_cppflags) \
-       -I$(top_srcdir)/gi/_glib \
-       -I$(top_srcdir)/gi \
-       $(GLIB_CFLAGS) \
-       $(GI_CFLAGS)
-_gi_la_CPPFLAGS = \
-       $(extension_cppflags)
-_gobject_la_LIBADD = \
-       $(extension_libadd) \
-       $(GLIB_LIBS) \
-       $(GI_LIBS) \
-       $(top_builddir)/gi/_glib/libpyglib-gi-2 0- PYTHON_BASENAME@.la
-_gobject_la_LDFLAGS = \
-       $(extension_ldflags) \
-       -export-symbols-regex "_gobject|PyInit__gobject"
-
 # if we build in a separate tree, we need to symlink the *.py files from the
 # source tree; Python does not accept the extensions and modules in different
 # paths
@@ -79,9 +18,5 @@ build_pylinks:
        done
 
 
-all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
-check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
-clean-local:
-       rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO))
-%$(PYTHON_SO): %.la
-       $(LN_S) -f .libs/$@ $@
+all: build_pylinks
+check-local: build_pylinks
diff --git a/gi/_gobject/__init__.py b/gi/_gobject/__init__.py
index d3ea0e0..0bd5742 100644
--- a/gi/_gobject/__init__.py
+++ b/gi/_gobject/__init__.py
@@ -27,7 +27,9 @@ import sys
 if 'gobject' in sys.modules:
     raise ImportError('When using gi.repository you must not import static modules like "gobject". Please 
change all occurrences of "import gobject" to "from gi.repository import GObject".')
 
-from . import _gobject
+import gi._gi
+_gobject = gi._gi._gobject
+
 from . import propertyhelper
 from . import signalhelper
 
diff --git a/gi/_gobject/constants.py b/gi/_gobject/constants.py
index 9565a66..5bb8665 100644
--- a/gi/_gobject/constants.py
+++ b/gi/_gobject/constants.py
@@ -19,7 +19,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
 # USA
 
-from . import _gobject
+import gi._gi
+_gobject = gi._gi._gobject
 
 TYPE_INVALID = _gobject.TYPE_INVALID
 TYPE_NONE = _gobject.type_from_name('void')
diff --git a/gi/_gobject/propertyhelper.py b/gi/_gobject/propertyhelper.py
index c9400df..0ee0d37 100644
--- a/gi/_gobject/propertyhelper.py
+++ b/gi/_gobject/propertyhelper.py
@@ -21,7 +21,8 @@
 
 import sys
 
-from . import _gobject
+import gi._gi
+_gobject = gi._gi._gobject
 
 from .constants import \
     TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, \
@@ -30,10 +31,15 @@ from .constants import \
     TYPE_FLOAT, TYPE_DOUBLE, TYPE_STRING, \
     TYPE_POINTER, TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, \
     TYPE_PYOBJECT, TYPE_GTYPE, TYPE_STRV, TYPE_VARIANT
-from ._gobject import \
-    G_MAXFLOAT, G_MAXDOUBLE, \
-    G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
-    G_MAXULONG
+
+G_MAXFLOAT = _gobject.G_MAXFLOAT
+G_MAXDOUBLE = _gobject.G_MAXDOUBLE
+G_MININT = _gobject.G_MININT
+G_MAXINT = _gobject.G_MAXINT
+G_MAXUINT = _gobject.G_MAXUINT
+G_MINLONG = _gobject.G_MINLONG
+G_MAXLONG = _gobject.G_MAXLONG
+G_MAXULONG = _gobject.G_MAXULONG
 
 if sys.version_info >= (3, 0):
     _basestring = str
diff --git a/gi/_gobject/signalhelper.py b/gi/_gobject/signalhelper.py
index b630158..19207cc 100644
--- a/gi/_gobject/signalhelper.py
+++ b/gi/_gobject/signalhelper.py
@@ -22,7 +22,8 @@
 import sys
 import inspect
 
-from . import _gobject
+import gi._gi
+_gobject = gi._gi._gobject
 
 # Callable went away in python 3.0 and came back in 3.2.
 # Use versioning to figure out when to define it, otherwise we have to deal with
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 12addbc..0ca6d40 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -21,11 +21,12 @@
  * USA
  */
 
+#include "pygobject-private.h"
+#include "pyginterface.h"
 #include "pygi-private.h"
 #include "pygi.h"
 #include "pyglib.h"
 
-#include <pygobject.h>
 #include <pyglib-python-compat.h>
 
 PyObject *PyGIDeprecationWarning;
@@ -627,6 +628,7 @@ static struct PyGI_API CAPI = {
 PYGLIB_MODULE_START(_gi, "_gi")
 {
     PyObject *api;
+    PyObject *_gobject_module;
 
     /* Always enable Python threads since we cannot predict which GI repositories
      * might accept Python callbacks run within non-Python threads or might trigger
@@ -635,13 +637,12 @@ PYGLIB_MODULE_START(_gi, "_gi")
      */
     PyEval_InitThreads ();
 
-    if (pygobject_init (-1, -1, -1) == NULL) {
-        return PYGLIB_MODULE_ERROR_RETURN;
-    }
-
-    if (_pygobject_import() < 0) {
+    _gobject_module = pyglib__gobject_module_create ();
+    if (_gobject_module == NULL) {
         return PYGLIB_MODULE_ERROR_RETURN;
     }
+    PyModule_AddObject (module, "_gobject", _gobject_module);
+    PyModule_AddStringConstant(module, "__package__", "gi._gi");
 
     _pygi_repository_register_types (module);
     _pygi_info_register_types (module);
diff --git a/gi/_gobject/gobjectmodule.c b/gi/gobjectmodule.c
similarity index 100%
rename from gi/_gobject/gobjectmodule.c
rename to gi/gobjectmodule.c
diff --git a/gi/module.py b/gi/module.py
index 8996926..22ae551 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -59,8 +59,8 @@ from .types import \
     GObjectMeta, \
     StructMeta
 
-from ._gobject._gobject import \
-    GInterface
+import gi._gi
+GInterface = gi._gi._gobject.GInterface
 
 from ._gobject.constants import \
     TYPE_NONE, \
diff --git a/gi/_gobject/pygboxed.c b/gi/pygboxed.c
similarity index 100%
rename from gi/_gobject/pygboxed.c
rename to gi/pygboxed.c
diff --git a/gi/_gobject/pygboxed.h b/gi/pygboxed.h
similarity index 100%
rename from gi/_gobject/pygboxed.h
rename to gi/pygboxed.h
diff --git a/gi/_gobject/pygenum.c b/gi/pygenum.c
similarity index 100%
rename from gi/_gobject/pygenum.c
rename to gi/pygenum.c
diff --git a/gi/_gobject/pygenum.h b/gi/pygenum.h
similarity index 100%
rename from gi/_gobject/pygenum.h
rename to gi/pygenum.h
diff --git a/gi/_gobject/pygflags.c b/gi/pygflags.c
similarity index 100%
rename from gi/_gobject/pygflags.c
rename to gi/pygflags.c
diff --git a/gi/_gobject/pygflags.h b/gi/pygflags.h
similarity index 100%
rename from gi/_gobject/pygflags.h
rename to gi/pygflags.h
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index 6378892..67367a0 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -22,12 +22,12 @@
  */
 
 #include "pygi-private.h"
+#include "pygobject-private.h"
 
 #include <string.h>
 #include <time.h>
 
 #include <datetime.h>
-#include <pygobject.h>
 #include <pyglib-python-compat.h>
 #include <pyglib.h>
 
@@ -1981,6 +1981,5 @@ void
 _pygi_argument_init (void)
 {
     PyDateTime_IMPORT;
-    _pygobject_import();
 }
 
diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c
index ea798ff..a9b39c1 100644
--- a/gi/pygi-boxed.c
+++ b/gi/pygi-boxed.c
@@ -22,8 +22,8 @@
  */
 
 #include "pygi-private.h"
+#include "pygobject-private.h"
 
-#include <pygobject.h>
 #include <girepository.h>
 #include <pyglib-python-compat.h>
 
diff --git a/gi/pygi-ccallback.c b/gi/pygi-ccallback.c
index 82777fb..7a35e60 100644
--- a/gi/pygi-ccallback.c
+++ b/gi/pygi-ccallback.c
@@ -22,8 +22,8 @@
  */
 
 #include "pygi-private.h"
+#include "pygobject-private.h"
 
-#include <pygobject.h>
 #include <girepository.h>
 #include <pyglib-python-compat.h>
 
diff --git a/gi/pygi-foreign.c b/gi/pygi-foreign.c
index 7537399..c046d0f 100644
--- a/gi/pygi-foreign.c
+++ b/gi/pygi-foreign.c
@@ -26,7 +26,7 @@
 #  include <config.h>
 #endif
 
-#include "pygobject.h"
+#include "pygobject-private.h"
 #include "pygi-foreign.h"
 
 #include <girepository.h>
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index af893ec..d0d2158 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -24,8 +24,8 @@
 
 #include "pygi-private.h"
 #include "pygi-cache.h"
+#include "pygobject-private.h"
 
-#include <pygobject.h>
 #include <pyglib-python-compat.h>
 
 
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
index 2c7a8de..9427754 100644
--- a/gi/pygi-marshal-to-py.c
+++ b/gi/pygi-marshal-to-py.c
@@ -22,12 +22,13 @@
  */
 
 #include "pygi-private.h"
+#include "pygobject-private.h"
+#include "pygparamspec.h"
 
 #include <string.h>
 #include <time.h>
 
 #include <pyglib.h>
-#include <pygobject.h>
 #include <pyglib-python-compat.h>
 
 #include "pygi-cache.h"
diff --git a/gi/pygi-private.h b/gi/pygi-private.h
index 97eced5..af12f1c 100644
--- a/gi/pygi-private.h
+++ b/gi/pygi-private.h
@@ -16,7 +16,7 @@
 
 #include "pygi.h"
 
-#include "pygobject-external.h"
+#include "pygobject-private.h"
 
 #include "pygi-repository.h"
 #include "pygi-info.h"
diff --git a/gi/pygi-source.c b/gi/pygi-source.c
index 66bbc3c..d2f39c6 100644
--- a/gi/pygi-source.c
+++ b/gi/pygi-source.c
@@ -23,8 +23,7 @@
  * IN THE SOFTWARE.
  */
 
-#define NO_IMPORT
-#include "pygobject.h"
+#include "pygobject-private.h"
 
 #include "pygi-private.h"
 #include "pyglib.h"
diff --git a/gi/pygi-struct.c b/gi/pygi-struct.c
index 296c47c..40bfb6d 100644
--- a/gi/pygi-struct.c
+++ b/gi/pygi-struct.c
@@ -22,8 +22,8 @@
  */
 
 #include "pygi-private.h"
+#include "pygobject-private.h"
 
-#include <pygobject.h>
 #include <girepository.h>
 #include <pyglib-python-compat.h>
 
diff --git a/gi/pygi.h b/gi/pygi.h
index dcd91b3..3a1591f 100644
--- a/gi/pygi.h
+++ b/gi/pygi.h
@@ -26,8 +26,7 @@
 #  include <config.h>
 #endif
 
-#define NO_IMPORT_PYGOBJECT
-#include <pygobject.h>
+#include <pygobject-private.h>
 
 #include <girepository.h>
 #include "pygi-cache.h"
diff --git a/gi/_gobject/pyginterface.c b/gi/pyginterface.c
similarity index 100%
rename from gi/_gobject/pyginterface.c
rename to gi/pyginterface.c
diff --git a/gi/_gobject/pyginterface.h b/gi/pyginterface.h
similarity index 100%
rename from gi/_gobject/pyginterface.h
rename to gi/pyginterface.h
diff --git a/gi/_gobject/pygobject-private.h b/gi/pygobject-private.h
similarity index 98%
rename from gi/_gobject/pygobject-private.h
rename to gi/pygobject-private.h
index 294b0f6..f48d073 100644
--- a/gi/_gobject/pygobject-private.h
+++ b/gi/pygobject-private.h
@@ -199,6 +199,7 @@ gboolean        pygobject_prepare_construct_properties  (GObjectClass *class,
                                                          PyObject *kwargs,
                                                          guint *n_params,
                                                          GParameter **params);
+/* Defined by PYGLIB_MODULE_START */
+extern PyObject *pyglib__gobject_module_create (void);
 
-
-#endif
+#endif /*_PYGOBJECT_PRIVATE_H_*/
diff --git a/gi/_gobject/pygobject.c b/gi/pygobject.c
similarity index 100%
rename from gi/_gobject/pygobject.c
rename to gi/pygobject.c
diff --git a/gi/_gobject/pygobject.h b/gi/pygobject.h
similarity index 100%
rename from gi/_gobject/pygobject.h
rename to gi/pygobject.h
diff --git a/gi/_gobject/pygparamspec.c b/gi/pygparamspec.c
similarity index 100%
rename from gi/_gobject/pygparamspec.c
rename to gi/pygparamspec.c
diff --git a/gi/_gobject/pygparamspec.h b/gi/pygparamspec.h
similarity index 97%
rename from gi/_gobject/pygparamspec.h
rename to gi/pygparamspec.h
index 64aab0c..b3ba8ca 100644
--- a/gi/_gobject/pygparamspec.h
+++ b/gi/pygparamspec.h
@@ -23,6 +23,8 @@
 #ifndef __PYGOBJECT_PARAMSPEC_H__ 
 #define __PYGOBJECT_PARAMSPEC_H__
 
+#include <glib-object.h>
+
 extern PyTypeObject PyGParamSpec_Type;
 PyObject * pyg_param_spec_new (GParamSpec *pspec);
 
diff --git a/gi/_gobject/pygpointer.c b/gi/pygpointer.c
similarity index 100%
rename from gi/_gobject/pygpointer.c
rename to gi/pygpointer.c
diff --git a/gi/_gobject/pygpointer.h b/gi/pygpointer.h
similarity index 100%
rename from gi/_gobject/pygpointer.h
rename to gi/pygpointer.h
diff --git a/gi/_gobject/pygtype.c b/gi/pygtype.c
similarity index 100%
rename from gi/_gobject/pygtype.c
rename to gi/pygtype.c
diff --git a/gi/_gobject/pygtype.h b/gi/pygtype.h
similarity index 100%
rename from gi/_gobject/pygtype.h
rename to gi/pygtype.h
diff --git a/gi/types.py b/gi/types.py
index 41efc05..c5b4bd5 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -26,7 +26,6 @@ import sys
 import warnings
 
 from . import _gobject
-from ._gobject._gobject import GInterface
 from ._gobject.constants import TYPE_INVALID
 from .docstring import generate_doc_string
 
@@ -38,6 +37,8 @@ from ._gi import \
     register_interface_info, \
     hook_up_vfunc_implementation
 
+import gi._gi
+GInterface = gi._gi._gobject.GInterface
 
 StructInfo  # pyflakes
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a687bbd..02063d0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -54,7 +54,7 @@ CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIM
 
 check_LTLIBRARIES += testhelper.la
 
-testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
+testhelper_la_CFLAGS = -I$(top_srcdir)/gi -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
 testhelper_la_LDFLAGS = -module -avoid-version
 testhelper_la_LIBADD = $(GLIB_LIBS)
 testhelper_la_SOURCES = \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]