[Users] [Bug 4271] New: Porting the Python plugin to Python 3.7

noreply at thewildbeast.co.uk noreply at thewildbeast.co.uk
Sun Nov 10 10:34:25 CET 2019


            Bug ID: 4271
           Summary: Porting the Python plugin to Python 3.7
           Product: Claws Mail
           Version: GIT
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Plugins/Python
          Assignee: users at lists.claws-mail.org
          Reporter: mail-claws at raphaelmichel.de

Created attachment 2016
Initial patch to port to Python 3

Hi there,

I'm a long-time user of the Claws Mail Python plugin to script custom hotkey
actions. As you probably all know, Python 2 reaches its end of life in less
than two months. For that reason, distributions like Arch Linux are already no
longer compiling Claws Mail with Python support, which bugged me. So I took the
weekend to try porting the Python plugin to Python 3.

The attached patch is enough to make all my simple scripts work on Python 3, as
well as the interactive Python shell. The scripts look mostly like this:

from datetime import date
archfolder = clawsmail.Folder('#imap/%s/Archives/%d' %
(clawsmail.get_folderview_selected_folder().mailbox.name, date.today().year))
msgs = clawsmail.get_summaryview_selected_message_list()
clawsmail.move_messages(msgs, archfolder)

There are a few caveats with the patch, that I likely won't have time to work
on, so if someone would be interested in continuing this, that would be

* The Patch does not retain Python 2 compatibility. Retaining it probably
wouldn't be to hard with a few simple macros, but I'm not sure it's worth the
hassle, given the end-of-life of Python 2. We could also ship two different
plugins, python.so and python2.so, etc.

* I did not port the example Python scripts in the repository.

* I couldn't properly test the integration with GTK, e.g. the replacement of
PyGTK with PyGI, which might take some more work to get right.

* I have no real experience coding C, so there might be some style issues with
the patch, I'm not sure.


You are receiving this mail because:
You are the assignee for the bug.

More information about the Users mailing list