1 Star 0 Fork 22

huanghaitao/mailman

forked from src-openEuler/mailman 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mailman-use-either-importlib_resources-or-directly-importlib.patch 2.67 KB
一键复制 编辑 原始数据 按行查看 历史
雷炬 提交于 2021-01-04 10:29 . Update mailman from 2.1.29 to 3.3.2
From a4bcacc25398fcea819bd9e6b9a531c3007aa386 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Fri, 16 Oct 2020 03:47:38 -0400
Subject: [PATCH] Use importlib.resources for Python 3.9+ and
importlib_resources otherwise
This makes it possible to use Mailman 3 in environments where importlib_resources
is not available.
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
---
setup.py | 2 +-
src/mailman/__init__.py | 5 +++++
src/mailman/testing/__init__.py | 23 +++++++++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index e1b2e07c5..b768ef3d2 100644
--- a/setup.py
+++ b/setup.py
@@ -121,7 +121,7 @@ case second 'm'. Any other spelling is incorrect.""",
'flufl.bounce',
'flufl.i18n>=2.0',
'flufl.lock>=3.1',
- 'importlib_resources>=1.1.0',
+ 'importlib_resources>=1.1.0 ; python_version<"3.9"',
'gunicorn',
'lazr.config',
'python-dateutil>=2.0',
diff --git a/src/mailman/__init__.py b/src/mailman/__init__.py
index fa5233fab..00990be45 100644
--- a/src/mailman/__init__.py
+++ b/src/mailman/__init__.py
@@ -37,3 +37,8 @@ if 'build_sphinx' not in sys.argv: # pragma: nocover
else:
from mailman.core.i18n import initialize
initialize()
+
+# Switch over to the internal importlib.resources module on Python 3.9+
+if sys.version_info >= (3, 9, 0):
+ import importlib.resources
+ sys.modules['importlib_resources'] = importlib.resources
diff --git a/src/mailman/testing/__init__.py b/src/mailman/testing/__init__.py
index e69de29bb..2b2ed536a 100644
--- a/src/mailman/testing/__init__.py
+++ b/src/mailman/testing/__init__.py
@@ -0,0 +1,23 @@
+# Copyright (C) 2009-2020 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see <https://www.gnu.org/licenses/>.
+
+import sys
+
+# Switch over to the internal importlib.resources module on Python 3.9+
+if sys.version_info >= (3, 9, 0):
+ import importlib.resources
+ sys.modules['importlib_resources'] = importlib.resources
--
2.28.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hht8/mailman.git
git@gitee.com:hht8/mailman.git
hht8
mailman
mailman
master

搜索帮助