From 2f59718a4bf22cbea28e0c7b2f880f86d4497a7a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 2 May 2012 10:44:13 +0100 Subject: Deprecate dbus.gobject_service and make it vaguely compatible with 1.0 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48904 --- dbus/gobject_service.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dbus/gobject_service.py b/dbus/gobject_service.py index 61a7749..85b72bb 100644 --- a/dbus/gobject_service.py +++ b/dbus/gobject_service.py @@ -22,7 +22,21 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -import gobject +from warnings import warn as _warn +_warn(DeprecationWarning("""\ +dbus.gobject_service is deprecated, and is not available under Python 3. + +Porting from gobject (PyGObject 2) to gi.repository.GObject (PyGObject 3), +and using dbus.gi_service instead of dbus.gobject_service, is recommended. +"""), DeprecationWarning, stacklevel=2) + +if 'gi' in sys.modules: + # this worked in dbus-python 1.0, so preserve the functionality + from gi.repository import GObject as gobject +else: + # this worked in dbus-python < 1.0 + import gobject + import dbus.service class ExportedGObjectType(gobject.GObjectMeta, dbus.service.InterfaceType): -- cgit v1.2.1