aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptrcnull <git@ptrcnull.me>2024-03-28 18:49:49 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2024-03-29 11:46:10 +0000
commitb10cfd7e992933369e1d7e4a15692c67800d43b3 (patch)
tree69a8164e7e548e3e02346b362093cf839a686f67
parentd43cff47c1f16809d7274e2c606f99a654f45ec1 (diff)
community/offlineimap: fix build with python 3.12HEADmaster
Closes: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/63084
-rw-r--r--community/offlineimap/APKBUILD4
-rw-r--r--community/offlineimap/py312-compat.patch50
2 files changed, 53 insertions, 1 deletions
diff --git a/community/offlineimap/APKBUILD b/community/offlineimap/APKBUILD
index 6758f9ab0ab..7534a766e31 100644
--- a/community/offlineimap/APKBUILD
+++ b/community/offlineimap/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
pkgname=offlineimap
pkgver=8.0.0
-pkgrel=0
+pkgrel=1
pkgdesc="Read/sync your IMAP mailboxes"
url="https://github.com/OfflineIMAP/offlineimap3"
arch="noarch"
@@ -21,6 +21,7 @@ makedepends="
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OfflineIMAP/offlineimap3/archive/v$pkgver.tar.gz
7cd32cf8-py311-compat.patch
+ py312-compat.patch
"
options="!check" # tests require an IMAP server and a Google account.
builddir="$srcdir/offlineimap3-$pkgver"
@@ -38,4 +39,5 @@ package() {
sha512sums="
7a6b7df7a366f748c80e5db7ca259eb6b83a4940fe11216e64ca11453ef41780d54e48ac24e77d3b5860de9b042bf710dde0352aae2dc518f09717b0fa9854c9 offlineimap-8.0.0.tar.gz
8d36053d650833bcf4f1830abbe582cdf843c0ed1fd4aba2da2ccbd06e45b9b4696ade0b2a8ba809afd1b6f7af9e9b7028f2d179249922b6918a14617a42dd9d 7cd32cf8-py311-compat.patch
+ae61defe427e8ccd42d8fab065aeb9a031e09ea741f057db975cd32db8b3e9602b90db668e2fe56c57c79ddb489709b4473395479cf0cac8da0de3eb8ac8ee67 py312-compat.patch
"
diff --git a/community/offlineimap/py312-compat.patch b/community/offlineimap/py312-compat.patch
new file mode 100644
index 00000000000..442805aab52
--- /dev/null
+++ b/community/offlineimap/py312-compat.patch
@@ -0,0 +1,50 @@
+deprecated in python 3.2
+
+diff --git a/offlineimap/CustomConfig.py b/offlineimap/CustomConfig.py
+index 59da078..758b936 100644
+--- a/offlineimap/CustomConfig.py
++++ b/offlineimap/CustomConfig.py
+@@ -17,13 +17,13 @@
+ import os
+ import re
+ from sys import exc_info
+-from configparser import SafeConfigParser, Error
++from configparser import ConfigParser, Error
+ from offlineimap.localeval import LocalEval
+
+
+-class CustomConfigParser(SafeConfigParser):
++class CustomConfigParser(ConfigParser):
+ def __init__(self):
+- SafeConfigParser.__init__(self)
++ ConfigParser.__init__(self)
+ self.localeval = None
+
+ def getdefault(self, section, option, default, *args, **kwargs):
+diff --git a/offlineimap/localeval.py b/offlineimap/localeval.py
+index 9168666..155f779 100644
+--- a/offlineimap/localeval.py
++++ b/offlineimap/localeval.py
+@@ -18,4 +18,3 @@
+
+-import imp
+-
++import importlib
+
+@@ -28,12 +27,10 @@ class LocalEval:
+ 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))
++ importlib.machinery.SOURCE_SUFFIXES.append('') # empty string to allow any file
++ 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)
+