Re: [meta-cgl][PATCH 1/2] crmsh: fix deprecation on collections.MutableSet


Jeremy Puhlman
 

Series merged. Thanks.

On 10/26/2021 12:45 AM, Yi Zhao wrote:
Python 3.10 removes the deprecated aliases to collections abstract base
clases [1]. Using 'collections.abc.MutableSet' instead of
'collections.MutableSet'

[1]: https://bugs.python.org/issue37324

Fixes:
$ crm
Traceback (most recent call last):
File "/usr/bin/crm", line 29, in <module>
from crmsh import main
File "/usr/lib64/python3.10/site-packages/crmsh/main.py", line 18, in <module>
from . import ui_root
File "/usr/lib64/python3.10/site-packages/crmsh/ui_root.py", line 23, in <module>
from . import ui_cib
File "/usr/lib64/python3.10/site-packages/crmsh/ui_cib.py", line 16, in <module>
from .cibconfig import cib_factory
File "/usr/lib64/python3.10/site-packages/crmsh/cibconfig.py", line 23, in <module>
from . import orderedset
File "/usr/lib64/python3.10/site-packages/crmsh/orderedset.py", line 29, in <module>
class OrderedSet(collections.MutableSet):
AttributeError: module 'collections' has no attribute 'MutableSet'

Signed-off-by: Yi Zhao <yi.zhao@...>
---
...x-deprecation-on-collections.Mutable.patch | 52 +++++++++++++++++++
.../recipes-cgl/crmsh/crmsh_4.3.1.bb | 1 +
2 files changed, 53 insertions(+)
create mode 100644 meta-cgl-common/recipes-cgl/crmsh/crmsh/0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch

diff --git a/meta-cgl-common/recipes-cgl/crmsh/crmsh/0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch b/meta-cgl-common/recipes-cgl/crmsh/crmsh/0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch
new file mode 100644
index 0000000..62db8e8
--- /dev/null
+++ b/meta-cgl-common/recipes-cgl/crmsh/crmsh/0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch
@@ -0,0 +1,52 @@
+From c1356d64086d2e3f9d113f346a14e6dff1c2acb0 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <yi.zhao@...>
+Date: Tue, 26 Oct 2021 14:01:09 +0800
+Subject: [PATCH] orderedset.py: fix deprecation on collections.MutableSet
+
+Python 3.10 removes the deprecated aliases to collections abstract
+base clases [1]. Using 'collections.abc.MutableSet' instead of
+'collections.MutableSet'
+
+[1]: https://bugs.python.org/issue37324
+
+Fixes:
+$ crm
+Traceback (most recent call last):
+ File "/usr/bin/crm", line 29, in <module>
+ from crmsh import main
+ File "/usr/lib64/python3.10/site-packages/crmsh/main.py", line 18, in <module>
+ from . import ui_root
+ File "/usr/lib64/python3.10/site-packages/crmsh/ui_root.py", line 23, in <module>
+ from . import ui_cib
+ File "/usr/lib64/python3.10/site-packages/crmsh/ui_cib.py", line 16, in <module>
+ from .cibconfig import cib_factory
+ File "/usr/lib64/python3.10/site-packages/crmsh/cibconfig.py", line 23, in <module>
+ from . import orderedset
+ File "/usr/lib64/python3.10/site-packages/crmsh/orderedset.py", line 29, in <module>
+ class OrderedSet(collections.MutableSet):
+AttributeError: module 'collections' has no attribute 'MutableSet'
+
+Upstream-Status: Submitted
+[https://github.com/ClusterLabs/crmsh/pull/882]
+
+Signed-off-by: Yi Zhao <yi.zhao@...>
+---
+ crmsh/orderedset.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/crmsh/orderedset.py b/crmsh/orderedset.py
+index 21ec480c..27233289 100644
+--- a/crmsh/orderedset.py
++++ b/crmsh/orderedset.py
+@@ -26,7 +26,7 @@ import collections
+ KEY, PREV, NEXT = list(range(3))
+
+
+-class OrderedSet(collections.MutableSet):
++class OrderedSet(collections.abc.MutableSet):
+
+ def __init__(self, iterable=None):
+ self.end = end = []
+--
+2.25.1
+
diff --git a/meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb b/meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb
index 75e720b..0b6ecd3 100644
--- a/meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb
+++ b/meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb
@@ -15,6 +15,7 @@ RDEPENDS:${PN} = "pacemaker python3-lxml python3-parallax gawk bash python3-doct
S = "${WORKDIR}/git"
SRC_URI = "git://github.com/ClusterLabs/${BPN}.git \
file://tweaks_for_build.patch \
+ file://0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch \
"
SRCREV = "00ec69054edecd068deda54c6184c0385d90ebd2"

Join yocto@lists.yoctoproject.org to automatically receive all group messages.