diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-02 10:44:13 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-02 10:44:13 +0100 |
commit | 2f59718a4bf22cbea28e0c7b2f880f86d4497a7a (patch) | |
tree | 35e5827b9715c39bc1b079b097372fd57ea48794 | |
parent | 5b9f87676802f04ebc339fd16a4a30dc42e33c91 (diff) | |
download | dbus-python-2f59718a4bf22cbea28e0c7b2f880f86d4497a7a.tar.gz |
Deprecate dbus.gobject_service and make it vaguely compatible with 1.0
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48904
-rw-r--r-- | dbus/gobject_service.py | 16 |
1 files changed, 15 insertions, 1 deletions
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): |