#39 Fix build with Python 3.12
Merged 10 months ago by churchyard. Opened 10 months ago by yselkowitz.
rpms/ yselkowitz/pcs rawhide  into  rawhide

@@ -0,0 +1,39 @@ 

+ From c878e1d06d834f0beb5579158ea5b98c42965058 Mon Sep 17 00:00:00 2001

+ From: Yaakov Selkowitz <yselkowi@redhat.com>

+ 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

+ 

file modified
+3
@@ -48,6 +48,9 @@ 

  # 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

  

@churchyard could you double check this please?

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/b472a2c6f0624d5aada4c0d75503e2f3

Looks reasonable. This is a change in the test code and the test passed. So I'd also say it works. The patch has been submitted upstream, there is a link to upstream PR in a comment and there is no need for a release bump + changelog entry because the previous commit did not build.

I'd personally use https://github.com/ClusterLabs/pcs/pull/713.patch directly as a patch instead of git-formatting my own, but that's not a requirement.

I wanted to say the patch number is not necessary, but the surrounding spec does some patch-numbers-related magic, so it's probably better to be explicit here.

I'll ship it.

Pull-Request has been merged by churchyard

10 months ago

Building pcs-0.11.6-2.fc39 for rawhide
Created task: 103182675
Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=103182675