Skip to contentSkip to conversation

crmsh: fix deprecation on collections.MutableSet

PATCH In review Yi Zhao 2 participants 3 messages Oct 26, 2021

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/2 crmsh: 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'
---
 ...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
meta-cgl-common/recipes-cgl/crmsh/crmsh/0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch new file +52 -0
new file mode 100644
index 0000000..62db8e8
@@ -0,0 +1,52 @@
+From c1356d64086d2e3f9d113f346a14e6dff1c2acb0 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+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 <[email protected]>
+---
+ 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
+
meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb +1 -0
index 75e720b..0b6ecd3 100644
@@ -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"
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 crmsh: add UPSTREAM_CHECK_GITTAGREGEX

Add UPSTREAM_CHECK_GITTAGREGEX to check the correct latest version.

Before the patch:

$ devtool latest-version crmsh
INFO: Current version: 4.3.1
INFO: Latest version: 12
INFO: Latest version's commit: 3308c27651a3657a019d7dc313435060f68454c5

After the patch:

$ devtool latest-version crmsh
INFO: Current version: 4.3.1
INFO: Latest version: 4.3.1
INFO: Latest version's commit: 00ec69054edecd068deda54c6184c0385d90ebd2
---
 meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb +2 -0
index 0b6ecd3..531a053 100644
@@ -20,6 +20,8 @@ SRC_URI = "git://github.com/ClusterLabs/${BPN}.git \
 
 SRCREV = "00ec69054edecd068deda54c6184c0385d90ebd2"
 
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))$"
+
 inherit autotools-brokensep setuptools3
 
 export HOST_SYS
Signature · 1 line
2.25.1
#2 lore raw
In reply to Yi Zhao

Series merged. Thanks.

Quoted 100 lines · Yi Zhao

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'
---
  ...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

meta-cgl-common/recipes-cgl/crmsh/crmsh/0001-orderedset.py-fix-deprecation-on-collections.Mutable.patch new file +52 -0
new file mode 100644
index 0000000..62db8e8
@@ -0,0 +1,52 @@
+From c1356d64086d2e3f9d113f346a14e6dff1c2acb0 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+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 <[email protected]>
+---
+ 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
+
meta-cgl-common/recipes-cgl/crmsh/crmsh_4.3.1.bb +1 -0
index 75e720b..0b6ecd3 100644
@@ -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"