diff --git a/0001-Fix-DatatransferObjectTest-for-Python-3.12.patch b/0001-Fix-DatatransferObjectTest-for-Python-3.12.patch new file mode 100644 index 0000000..0792a4d --- /dev/null +++ b/0001-Fix-DatatransferObjectTest-for-Python-3.12.patch @@ -0,0 +1,39 @@ +From c878e1d06d834f0beb5579158ea5b98c42965058 Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Mon, 10 Jul 2023 12:56:41 -0400 +Subject: [PATCH] Fix DatatransferObjectTest for Python 3.12 + +This fixes a test error when run with Python 3.12: +``` +Traceback (most recent call last): + File "pcs_test/tier0/common/interface/test_dto.py", line 41, in test_has_all_subclasses_are_dataclasses + _import_all(pcs.__path__) + File "pcs_test/tier0/common/interface/test_dto.py", line 31, in _import_all + loader.find_module(module_name).load_module(module_name) + ^^^^^^^^^^^^^^^^^^ +AttributeError: 'FileFinder' object has no attribute 'find_module' +``` +Instead, use the spec-based APIs introduced in 3.4: + +https://docs.python.org/3.12/library/importlib.html#importlib.machinery.FileFinder +https://docs.python.org/3.12/library/importlib.html#importlib.machinery.ModuleSpec +--- + pcs_test/tier0/common/interface/test_dto.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pcs_test/tier0/common/interface/test_dto.py b/pcs_test/tier0/common/interface/test_dto.py +index 4c3dcb8b..977f35c9 100644 +--- a/pcs_test/tier0/common/interface/test_dto.py ++++ b/pcs_test/tier0/common/interface/test_dto.py +@@ -28,7 +28,7 @@ def _import_all(_path): + if module_name.startswith("_pcs.snmp."): + continue + del is_pkg +- loader.find_module(module_name).load_module(module_name) ++ loader.find_spec(module_name).loader.load_module(module_name) + + + def _all_subclasses(cls): +-- +2.41.0 + diff --git a/pcs.spec b/pcs.spec index 53fe036..0e9b28a 100644 --- a/pcs.spec +++ b/pcs.spec @@ -48,6 +48,9 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm # pcs patches: <= 200 # Patch0: name.patch +# https://github.com/ClusterLabs/pcs/pull/713 +Patch0: 0001-Fix-DatatransferObjectTest-for-Python-3.12.patch + # ui patches: >200 # Patch201: name-web-ui.patch