offlineimap: rebuild for Python 3.12

This commit is contained in:
Andrew J. Hesford 2023-09-23 21:03:41 -04:00
parent 99ac3c3f1c
commit 0b6b518905
3 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,11 @@
--- ./offlineimap/CustomConfig.py.orig 2023-09-29 15:01:26.825986775 -0400
+++ ./offlineimap/CustomConfig.py 2023-09-29 15:02:02.804202132 -0400
@@ -17,7 +17,7 @@
import os
import re
from sys import exc_info
-from configparser import SafeConfigParser, Error
+from configparser import ConfigParser as SafeConfigParser, Error
from offlineimap.localeval import LocalEval

View file

@ -0,0 +1,38 @@
From 4601f50d98cffcb182fddb04f8a78c795004bc73 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Wed, 6 Sep 2023 08:31:29 +0200
Subject: [PATCH] Py 3.12 compat - do not use the obsoleted imp module
---
offlineimap/localeval.py | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/offlineimap/localeval.py b/offlineimap/localeval.py
index 91686666..03ab1b66 100644
--- a/offlineimap/localeval.py
+++ b/offlineimap/localeval.py
@@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-import imp
+import importlib.util
class LocalEval:
@@ -28,12 +28,9 @@ def __init__(self, path=None):
if path is not None:
# FIXME: limit opening files owned by current user with rights set
# to fixed mode 644.
- foo = open(path, 'r')
- module = imp.load_module(
- '<none>',
- foo,
- path,
- ('', 'r', imp.PY_SOURCE))
+ spec = importlib.util.spec_from_file_location('<none>', path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
for attr in dir(module):
self.namespace[attr] = getattr(module, attr)

View file

@ -1,7 +1,7 @@
# Template file for 'offlineimap'
pkgname=offlineimap
version=8.0.0
revision=3
revision=4
build_style=python3-module
make_check_args="--ignore test/tests/test_00_imaputil.py
--ignore test/tests/test_01_basic.py --ignore test/tests/test_02_MappedIMAP.py"