[packagekit] Synchronous Python interface

Richard Hughes hughsient at gmail.com
Tue Jul 8 13:01:38 PDT 2008


On Tue, 2008-07-08 at 18:27 +0200, Martin Pitt wrote:
> Hi all,
> 
> in my current driver search/UI project "Jockey" [1] I want to provide
> a sensible upstream implementation for package query/install/remove
> methods, so I started intregrating PackageKit support (since it now
> works on Ubuntu Intrepid).

Sweet.

> The raw D-BUS interface is slightly inconvenient to use for me, since
> it is fully asynchronous. For my purposes (package installation etc.
> happens in the jockey backend, frontends communicate with it through
> the system D-BUS), this is pretty redundant to me, since D-BUS already
> provides asynchronous method calls, and otherwise the Jockey backend
> is using a synchronous style.

Right. You probably want to be adding your code to the git server --
probably in python/ but I don't know the convention. We probably need to
have different classes for async and sync, but I'm no python dude.

> Thus I went ahead and created a fairly easy Python class for calling
> the most common PackageKit functions from a Python program,
> including some demo code.
> 
> The usage is fairly simple:
> 
>     pk = PackageKitClient()

Looks good.

> I welcome any suggestions how to improve it, or LARTing why
> asynchronous APIs are better :-P

Async API's are not any better or worse, they just make it easier to do
stuff without blocking. The GpkClient interface in gnome-packagekit can
be made to block like you've done in python, as sometimes it's just
waaay easier.

Richard.




More information about the PackageKit mailing list