Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support py3.12 #164

Closed
chenrui333 opened this issue Oct 17, 2023 · 1 comment
Closed

Support py3.12 #164

chenrui333 opened this issue Oct 17, 2023 · 1 comment

Comments

@chenrui333
Copy link

I am trying to build 8.0.0 against py3.12, but ran into some build failure

Using pip 23.2.1 from /opt/homebrew/lib/python3.12/site-packages/pip (python 3.12)
Processing /private/tmp/offlineimap-20231017-80784-1fleq5o/offlineimap3-8.0.0
  Preparing metadata (setup.py): started
  Running command python setup.py egg_info
  /opt/homebrew/Cellar/offlineimap/8.0.0_1/libexec/lib/python3.12/site-packages/imaplib2/imaplib2.py:2493: SyntaxWarning: invalid escape sequence '\D'
    ('store', ('1', 'FLAGS', '(\Deleted)')),
  /opt/homebrew/Cellar/offlineimap/8.0.0_1/libexec/lib/python3.12/site-packages/imaplib2/imaplib2.py:2598: SyntaxWarning: invalid escape sequence '\D'
    run('uid', ('STORE', uid[-1], 'FLAGS', '(\Deleted)'))
  /opt/homebrew/Cellar/offlineimap/8.0.0_1/libexec/lib/python3.12/site-packages/imaplib2/imaplib2.py:2612: SyntaxWarning: invalid escape sequence '\S'
    run('store', (num, '-FLAGS', '(\Seen)'), cb=False),
  /opt/homebrew/Cellar/offlineimap/8.0.0_1/libexec/lib/python3.12/site-packages/imaplib2/imaplib2.py:2615: SyntaxWarning: invalid escape sequence '\D'
    run('uid', ('STORE', num, 'FLAGS', '(\Deleted)'))
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/private/tmp/offlineimap-20231017-80784-1fleq5o/offlineimap3-8.0.0/setup.py", line 25, in <module>
      import offlineimap
    File "/private/tmp/offlineimap-20231017-80784-1fleq5o/offlineimap3-8.0.0/offlineimap/__init__.py", line 20, in <module>
      from offlineimap.init import OfflineImap
    File "/private/tmp/offlineimap-20231017-80784-1fleq5o/offlineimap3-8.0.0/offlineimap/init.py", line 35, in <module>
      from offlineimap import threadutil, accounts, folder, mbnames
    File "/private/tmp/offlineimap-20231017-80784-1fleq5o/offlineimap3-8.0.0/offlineimap/accounts.py", line 24, in <module>
      from offlineimap import mbnames, CustomConfig, OfflineImapError
    File "/private/tmp/offlineimap-20231017-80784-1fleq5o/offlineimap3-8.0.0/offlineimap/CustomConfig.py", line 20, in <module>
      from configparser import SafeConfigParser, Error
  ImportError: cannot import name 'SafeConfigParser' from 'configparser' (/opt/homebrew/Cellar/python@3.12/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/configparser.py). Did you mean: 'RawConfigParser'?
  error: subprocess-exited-with-error

relates to Homebrew/homebrew-core#151139

@thekix
Copy link
Member

thekix commented Nov 22, 2023

Hi @chenrui333

Please, could you try to change in the file offlineimap/CustomConfig.py the word (Class) "SafeConfigParser" with the word (Class) "ConfigParser"? This string is three times in the file. See the diff code below.

The reason seems that SafeConfigParser was renamed to ConfigParser in Python 3.2, and the SafeConfigParser name was kept for backward compatibility until Python 3.11. So we can use ConfigParser instead of SafeConfigParser.

If you try it and it works fine, I will create a new pull-request. Also, you can create it if you want.

Best regards,
kix

kix:~/src/offlineimap3/offlineimap$ diff CustomConfig.py-new CustomConfig.py
20c20
< from configparser import ConfigParser, Error
---
> from configparser import SafeConfigParser, Error
24c24
< class CustomConfigParser(ConfigParser):
---
> class CustomConfigParser(SafeConfigParser):
26c26
<         ConfigParser.__init__(self)
---
>         SafeConfigParser.__init__(self)
kix:~/src/offlineimap3/offlineimap$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants