[pygobject] refactor the internal _glib module to import correct modules
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] refactor the internal _glib module to import correct modules
- Date: Thu, 11 Aug 2011 12:48:45 +0000 (UTC)
commit c980dae21468fe073cc8782608148c346bb90ad7
Author: John (J5) Palmieri <johnp redhat com>
Date: Fri Jul 22 11:16:00 2011 -0400
refactor the internal _glib module to import correct modules
https://bugzilla.gnome.org/show_bug.cgi?id=642048
gi/_glib/__init__.py | 3 ++-
gi/_glib/glibmodule.c | 10 +++++-----
gi/_glib/option.py | 4 ++--
gi/_glib/pyglib.c | 18 +++++++++---------
4 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/gi/_glib/__init__.py b/gi/_glib/__init__.py
index b114cb9..f56e6d5 100644
--- a/gi/_glib/__init__.py
+++ b/gi/_glib/__init__.py
@@ -19,7 +19,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
-from glib._glib import *
+from ._glib import *
+
_PyGLib_API = _glib._PyGLib_API
del _glib
diff --git a/gi/_glib/glibmodule.c b/gi/_glib/glibmodule.c
index 963e5ea..f01ee77 100644
--- a/gi/_glib/glibmodule.c
+++ b/gi/_glib/glibmodule.c
@@ -246,7 +246,7 @@ iowatch_marshal(GIOChannel *source,
} else {
if (ret == Py_None) {
if (PyErr_Warn(PyExc_Warning,
- "glib.io_add_watch callback returned None; "
+ "_glib.io_add_watch callback returned None; "
"should return True/False")) {
PyErr_Print();
}
@@ -373,7 +373,7 @@ pyglib_child_watch_add(PyObject *unused, PyObject *args, PyObject *kwargs)
return NULL;
if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError,
- "glib.child_watch_add: second argument must be callable");
+ "_glib.child_watch_add: second argument must be callable");
return NULL;
}
@@ -800,7 +800,7 @@ pyglib_register_api(PyObject *d)
/* for addon libraries ... */
PyDict_SetItemString(d, "_PyGLib_API",
- o=PYGLIB_CPointer_WrapPointer(&pyglib_api,"glib._PyGLib_API"));
+ o=PYGLIB_CPointer_WrapPointer(&pyglib_api,"gi._glib._PyGLib_API"));
Py_DECREF(o);
pyglib_init_internal(o);
@@ -817,7 +817,7 @@ pyglib_register_error(PyObject *d)
* GError has also an "message" attribute.
*/
PyDict_SetItemString(dict, "message", Py_None);
- gerror_class = PyErr_NewException("glib.GError", PyExc_RuntimeError, dict);
+ gerror_class = PyErr_NewException("gi._glib.GError", PyExc_RuntimeError, dict);
Py_DECREF(dict);
PyDict_SetItemString(d, "GError", gerror_class);
@@ -950,7 +950,7 @@ pyglib_register_constants(PyObject *m)
(char*) g_quark_to_string(G_OPTION_ERROR));
}
-PYGLIB_MODULE_START(_glib, "glib._glib")
+PYGLIB_MODULE_START(_glib, "_glib")
{
PyObject *d = PyModule_GetDict(module);
diff --git a/gi/_glib/option.py b/gi/_glib/option.py
index bdfbe1d..c84d303 100644
--- a/gi/_glib/option.py
+++ b/gi/_glib/option.py
@@ -41,8 +41,8 @@ else:
_basestring = basestring
_bytes = str
-import glib
-_glib = sys.modules['glib._glib']
+import gi._glib
+_glib = sys.modules['gi._glib._glib']
__all__ = [
"OptParseError",
diff --git a/gi/_glib/pyglib.c b/gi/_glib/pyglib.c
index 1e024c2..f127fb4 100644
--- a/gi/_glib/pyglib.c
+++ b/gi/_glib/pyglib.c
@@ -40,7 +40,7 @@ pyglib_init(void)
{
PyObject *glib, *cobject;
- glib = PyImport_ImportModule("glib");
+ glib = PyImport_ImportModule("gi._glib");
if (!glib) {
if (PyErr_Occurred()) {
PyObject *type, *value, *traceback;
@@ -51,22 +51,22 @@ pyglib_init(void)
Py_XDECREF(value);
Py_XDECREF(traceback);
PyErr_Format(PyExc_ImportError,
- "could not import glib (error was: %s)",
+ "could not import gi._glib (error was: %s)",
PYGLIB_PyUnicode_AsString(py_orig_exc));
Py_DECREF(py_orig_exc);
} else {
PyErr_SetString(PyExc_ImportError,
- "could not import glib (no error given)");
+ "could not import gi._glib (no error given)");
}
return;
}
cobject = PyObject_GetAttrString(glib, "_PyGLib_API");
if (cobject && PYGLIB_CPointer_Check(cobject))
- _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(cobject, "glib._PyGLib_API");
+ _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(cobject, "gi._glib._PyGLib_API");
else {
PyErr_SetString(PyExc_ImportError,
- "could not import glib (could not find _PyGLib_API object)");
+ "could not import gi._glib (could not find _PyGLib_API object)");
Py_DECREF(glib);
return;
}
@@ -75,7 +75,7 @@ pyglib_init(void)
void
pyglib_init_internal(PyObject *api)
{
- _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(api, "glib._PyGLib_API");
+ _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(api, "gi._glib._PyGLib_API");
}
gboolean
@@ -338,20 +338,20 @@ pyglib_gerror_exception_check(GError **error)
py_message = PyObject_GetAttrString(value, "message");
if (!py_message || !PYGLIB_PyUnicode_Check(py_message)) {
- bad_gerror_message = "glib.GError instances must have a 'message' string attribute";
+ bad_gerror_message = "gi._glib.GError instances must have a 'message' string attribute";
goto bad_gerror;
}
py_domain = PyObject_GetAttrString(value, "domain");
if (!py_domain || !PYGLIB_PyUnicode_Check(py_domain)) {
- bad_gerror_message = "glib.GError instances must have a 'domain' string attribute";
+ bad_gerror_message = "gi._glib.GError instances must have a 'domain' string attribute";
Py_DECREF(py_message);
goto bad_gerror;
}
py_code = PyObject_GetAttrString(value, "code");
if (!py_code || !PYGLIB_PyLong_Check(py_code)) {
- bad_gerror_message = "glib.GError instances must have a 'code' int attribute";
+ bad_gerror_message = "gi._glib.GError instances must have a 'code' int attribute";
Py_DECREF(py_message);
Py_DECREF(py_domain);
goto bad_gerror;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]