From 0b6b518905bf0326e10a8072a6bae146f7ee6441 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 23 Sep 2023 21:03:41 -0400 Subject: [PATCH] offlineimap: rebuild for Python 3.12 --- .../patches/python3.12-config.patch | 11 ++++++ .../patches/python3.12-import.patch | 38 +++++++++++++++++++ srcpkgs/offlineimap/template | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/offlineimap/patches/python3.12-config.patch create mode 100644 srcpkgs/offlineimap/patches/python3.12-import.patch diff --git a/srcpkgs/offlineimap/patches/python3.12-config.patch b/srcpkgs/offlineimap/patches/python3.12-config.patch new file mode 100644 index 00000000000..625799bbfc7 --- /dev/null +++ b/srcpkgs/offlineimap/patches/python3.12-config.patch @@ -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 + + diff --git a/srcpkgs/offlineimap/patches/python3.12-import.patch b/srcpkgs/offlineimap/patches/python3.12-import.patch new file mode 100644 index 00000000000..c8a24bf3c24 --- /dev/null +++ b/srcpkgs/offlineimap/patches/python3.12-import.patch @@ -0,0 +1,38 @@ +From 4601f50d98cffcb182fddb04f8a78c795004bc73 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +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( +- '', +- foo, +- path, +- ('', 'r', imp.PY_SOURCE)) ++ spec = importlib.util.spec_from_file_location('', path) ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) + for attr in dir(module): + self.namespace[attr] = getattr(module, attr) + diff --git a/srcpkgs/offlineimap/template b/srcpkgs/offlineimap/template index 75dc29bc468..2fa738c5597 100644 --- a/srcpkgs/offlineimap/template +++ b/srcpkgs/offlineimap/template @@ -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"