For the record, to help readers of the mailing list navigate the package
transformations syntax, here is what I did when faced with this bug:

replaced offlineimap in my home-configuration.scm with:

    ((options->transformation
      (list `(with-patch . "offlineimap3=patches/offlineimap3.patch")))
     offlineimap3)

With the patch file lifted from the (at the time yet unmerged) PR on
offlineimap's github repo:

commit 4c64d72882925238c94047120314a0a3209364d0
Author: Tugdual Saunier <tugdual.saun...@gmail.com>

    fix: "module importlib has no attribute 'machinery'"

    Since the merge of #190, the following errors happens:
    ```
    ERROR: module 'importlib' has no attribute 'machinery'
    ERROR: Exceptions occurred during the run!
    ERROR: AttributeError: module 'importlib' has no attribute 'machinery'
    ```
    This commit should fix this by importing the required package.

diff --git a/offlineimap/localeval.py b/offlineimap/localeval.py
index 3b137e0..286657f 100644
--- a/offlineimap/localeval.py
+++ b/offlineimap/localeval.py
@@ -26,6 +26,8 @@ class LocalEval:
         self.namespace = {}

         if path is not None:
+            import importlib.machinery
+
             # FIXME: limit opening files owned by current user with rights set
             # to fixed mode 644.
             importlib.machinery.SOURCE_SUFFIXES.append('') # empty string to 
allow any file



I hope this can help other people faced with an unmerged fix to a
pressing issue.

Apart from Gentoo, Plan 9/Inferno, (and sourcemage when it existed), I know of 
no other
system than Guix that can handle patching one one's software with such ease.

Cheers,

Edouard.


Tracker <lambdatro...@disroot.org> writes:

> Cayetano Santos <csant...@inventati.org> writes:
>
>>>mer. 23 avril 2025 at 11:56, Gary Johnson <lambdatro...@disroot.org> wrote:
>>
>>> Hi Guix,
>>>
>>> The offlineimap3 package is broken in the current version of Guix due
>>> to a longstanding bug in offlineimap3 that makes it incompatible with
>>> Python 3.11 (which is now the default python version in Guix).
>>
>> A patch upgrading to latest offlineimap has been already merged, 3f61193716.
>>
>> Could you try it and confirm it fixes the problem ?
>
> The offlineimap3 package on the latest Guix main branch now works
> correctly for me. I checked the code for the new package and it is
> equivalent to the version that I shared in this thread. Thanks to
> whomever got this merged so quickly!
>
> Cheers,
>   Gary

Reply via email to