From 8c902c8923066fe132005d6200fff7e98bcc6edb Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 28 Jun 2023 09:46:52 -0400 Subject: [PATCH 1/2] Prefer importlib.reload to imp.reload In aeidon/test/test_locales.py, use importlib.reload where available (Python 3.4 and later) instead of imp.reload; the imp module has been deprecated since Python 3.4 and is removed in Python 3.12, so this is a Python 3.12 compatibility fix. --- aeidon/test/test_locales.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aeidon/test/test_locales.py b/aeidon/test/test_locales.py index 5ac4a66d..b0b7632a 100644 --- a/aeidon/test/test_locales.py +++ b/aeidon/test/test_locales.py @@ -16,7 +16,10 @@ # along with this program. If not, see . import aeidon -import imp +try: + from importlib import reload # Python 3.4 and later +except ImportError: + from imp import reload # Python 3.11 and older from aeidon.i18n import _, d_ from unittest.mock import patch @@ -46,10 +49,10 @@ def test_get_system_code(self): @patch.dict("os.environ", dict(LANGUAGE="sr@Latn")) def test_get_system_modifier__latn(self): - imp.reload(aeidon.locales) + reload(aeidon.locales) assert aeidon.locales.get_system_modifier() == "Latn" @patch.dict("os.environ", dict(LANGUAGE="en")) def test_get_system_modifier__none(self): - imp.reload(aeidon.locales) + reload(aeidon.locales) assert aeidon.locales.get_system_modifier() is None From 4fa304723ba457fae62d580fadce4debb9c4b7da Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 28 Jun 2023 15:46:29 -0400 Subject: [PATCH 2/2] Do not claim to support Python versions before 3.4 --- README.md | 2 +- aeidon/test/test_locales.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3f05372e..4036aee3 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ and gettext to build the Flatpak. #### Source -Gaupol requires Python ≥ 3.2, PyGObject ≥ 3.12 and GTK ≥ 3.12. +Gaupol requires Python ≥ 3.4, PyGObject ≥ 3.12 and GTK ≥ 3.12. Additionally, during installation you need gettext. Optional, but strongly recommended dependencies include: diff --git a/aeidon/test/test_locales.py b/aeidon/test/test_locales.py index b0b7632a..711b4521 100644 --- a/aeidon/test/test_locales.py +++ b/aeidon/test/test_locales.py @@ -16,10 +16,7 @@ # along with this program. If not, see . import aeidon -try: - from importlib import reload # Python 3.4 and later -except ImportError: - from imp import reload # Python 3.11 and older +import importlib from aeidon.i18n import _, d_ from unittest.mock import patch @@ -49,10 +46,10 @@ def test_get_system_code(self): @patch.dict("os.environ", dict(LANGUAGE="sr@Latn")) def test_get_system_modifier__latn(self): - reload(aeidon.locales) + importlib.reload(aeidon.locales) assert aeidon.locales.get_system_modifier() == "Latn" @patch.dict("os.environ", dict(LANGUAGE="en")) def test_get_system_modifier__none(self): - reload(aeidon.locales) + importlib.reload(aeidon.locales) assert aeidon.locales.get_system_modifier() is None