Bug 85720

Summary: Make dbus-python examples compatible with python3 and fix gconf ones
Product: dbus Reporter: Ben Longbons <b.r.longbons>
Component: pythonAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: D-Bus Maintainers <dbus>
Severity: enhancement    
Priority: medium Keywords: patch
Version: git master   
Hardware: All   
OS: All   
Whiteboard: review+
i915 platform: i915 features:
Attachments: patch 1/2
patch 2/2

Description Ben Longbons 2014-10-31 22:13:03 UTC
Created attachment 108744 [details] [review]
patch 1/2

The attached 2 patches update the examples to be compatible with python3 (as well as python2), and fixes the gconf examples (including executable bits and installation).

Note that gconf examples require an additional package besides dbus-python itself; on Debian it is called `gir1.2-gconf-2.0`.

You can also merge them with the following command:
git pull git://github.com/o11c/dbus-python.git py3-examples

Or browse at https://github.com/o11c/dbus-python/tree/py3-examples
Comment 1 Ben Longbons 2014-10-31 22:13:39 UTC
Created attachment 108745 [details] [review]
patch 2/2
Comment 2 Simon McVittie 2015-01-06 22:41:55 UTC
Comment on attachment 108744 [details] [review]
patch 1/2

Review of attachment 108744 [details] [review]:
-----------------------------------------------------------------

::: examples/gconf-proxy-client.py
@@ +28,4 @@
>  gconf_key = "/desktop/gnome/file_views/icon_theme"
>  
>  bus = dbus.SessionBus()
> +gconf_key_object = dbus.Interface(bus.get_object("org.gnome.GConf.Example", "/org/gnome/GConf" + gconf_key), "org.gnome.GConf")

Is this example even desirable? GConf is fairly heavily deprecated.

On the other hand, so is dbus-glib, and we use that, so...

::: examples/gconf-proxy-service2.py
@@ +34,2 @@
>  
> +# there is a real service called "org.gnome.GConf"; don't collide with it.

Amusingly, when this example was written, it was a proxy from GConf (which didn't use D-Bus at the time) to D-Bus.

Now that GConf does use D-Bus, the implementation is "do nothing, it is already on D-Bus" :-P
Comment 3 Simon McVittie 2015-01-06 22:44:34 UTC
Comment on attachment 108745 [details] [review]
patch 2/2

Review of attachment 108745 [details] [review]:
-----------------------------------------------------------------

Yes this all looks reasonable.

::: examples/example-async-client.py
@@ +1,3 @@
>  #!/usr/bin/env python
>  
> +from __future__ import print_function

I was concerned that this might bump dbus-python's Python dependency, but we already require 2.6.
Comment 4 Ben Longbons 2015-01-06 23:02:27 UTC
> Is this example even desirable? GConf is fairly heavily deprecated.

To me the important thing is demonstrating the use FallbackObject, which is poorly documented otherwise.
Comment 5 Simon McVittie 2015-12-06 17:47:55 UTC
Fixed in git master for 1.2.1 (or whatever I end up calling it). Thanks for your patches!

I split 1/2 up a bit, since it included some not-so-related changes, including one that touches the actual implementation (not just tests).

(In reply to Ben Longbons from comment #4)
> > Is this example even desirable? GConf is fairly heavily deprecated.
> 
> To me the important thing is demonstrating the use FallbackObject, which is
> poorly documented otherwise.

I added a comment about that.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.