After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685234 - Port to python 3
Port to python 3
Product: gnome-clocks
Classification: Applications
Component: general
Other Linux
: Normal normal
: ---
Assigned To: Clocks maintainer(s)
Clocks maintainer(s)
Depends on:
Blocks: python3
Reported: 2012-10-01 17:32 UTC by Maël Lavault
Modified: 2013-01-08 13:34 UTC
See Also:
GNOME target: ---
GNOME version: ---

Port gnome-clocks to python3 (6.48 KB, patch)
2012-12-24 16:28 UTC, Maël Lavault
none Details | Review
updated patch (7.32 KB, patch)
2013-01-03 12:25 UTC, Paolo Borelli
needs-work Details | Review

Description Maël Lavault 2012-10-01 17:32:45 UTC
It seems that soon, gnome will advise every apps to upgrade to python 3. Maybe we can start this port now, like many gnome apps.
Comment 1 Maël Lavault 2012-12-24 16:28:06 UTC
Created attachment 232199 [details] [review]
Port gnome-clocks to python3

Here is the patch, you have to add os.environ['PYTHON'] = 'python3'to your jhbuildrc to test it.

And make sure you have a python3 version of pygobject.
Comment 2 Paolo Borelli 2012-12-29 16:28:31 UTC
Review of attachment 232199 [details] [review]:

Hi Mael! Thanks for the patch, it looks pretty good... I think we miss a couple of things

 - we need a py3 version of pycanberra, there is a patch/fork on the github project and we can use that one
 - I think we can just put /bin/env python3 in the hashbang instead of having to export the env var
Comment 3 Maël Lavault 2012-12-31 01:39:05 UTC
Hi ! :)

You are right, 

I kinda was hoping that libcanberra would be ported to gobject-inrospection by the time but i can see i was wrong :(
I will apply the pycanberra patch to test it out.

The exported env var was also for jhbuild, so it can install everything in the right place. Of course /bin/env python3 would be better.
Comment 4 Paolo Borelli 2013-01-03 12:25:12 UTC
Created attachment 232630 [details] [review]
updated patch

I committed the updated pycanberra since that also works with py2.

Then I updated the patch and tested, but there are still a few things that do not work:

 - To run in jhbuild, you need to export PYTHON because jhbuild uses that to set PYTHONPATH appropriately
 - I get "TypeError: Couldn't find conversion for foreign struct 'cairo.Context'" and the drawing does not work
 - I fixed the utf8 json handling for loading the files, but probably file saving needs to fixed too
Comment 5 Paolo Borelli 2013-01-08 13:34:09 UTC
the cairo error seems gone now that I rebuilt things cleanly. So I fixed up the file handling and pushed. Thanks!