From 238814e5a196a7e1568f50223cbddc35518e4615 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 2 Mar 2022 22:57:34 -0800 Subject: [PATCH] python3-slip-dbus: Fix build with wheel packaging Migrate to use setuptools instead of distutils merge slip.dbus into slip module since we use slip.dbus, it works fine for OE Signed-off-by: Khem Raj Signed-off-by: Trevor Gamblin --- ...-Use-setuptools-instead-of-distutils.patch | 38 ++++++++++ ...9c0b534c1b7958fa0a3c7aedf30bca910431.patch | 76 +++++++++++++++++++ .../python/python3-slip-dbus_0.6.5.bb | 11 ++- 3 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 meta-python/recipes-devtools/python/python3-slip-dbus/0001-setup.py-Use-setuptools-instead-of-distutils.patch create mode 100644 meta-python/recipes-devtools/python/python3-slip-dbus/9b939c0b534c1b7958fa0a3c7aedf30bca910431.patch diff --git a/meta-python/recipes-devtools/python/python3-slip-dbus/0001-setup.py-Use-setuptools-instead-of-distutils.patch b/meta-python/recipes-devtools/python/python3-slip-dbus/0001-setup.py-Use-setuptools-instead-of-distutils.patch new file mode 100644 index 0000000000..1208769b2f --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-slip-dbus/0001-setup.py-Use-setuptools-instead-of-distutils.patch @@ -0,0 +1,38 @@ +From 4309ce76351b1685d08b3ba55d4f62b3e53ef76b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 1 Mar 2022 19:06:35 -0800 +Subject: [PATCH] setup.py: Use setuptools instead of distutils + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + setup.py.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/setup.py.in ++++ b/setup.py.in +@@ -2,20 +2,17 @@ + # -*- coding: utf-8 -*- + + import sys +-from distutils.core import setup ++from setuptools import setup, find_packages + + setup(name="slip", version="@VERSION@", + py_modules=["slip.__init__", "slip.util.__init__", + "slip.util.hookable", "slip.util.files", +- "slip._wrappers.__init__", "slip._wrappers._glib"], +- requires=["selinux"]) +- +-setup(name="slip.dbus", version="@VERSION@", +- py_modules=["slip.dbus.__init__", "slip.dbus.bus", ++ "slip._wrappers.__init__", "slip._wrappers._glib", ++ "slip.dbus.__init__", "slip.dbus.bus", + "slip.dbus.constants", "slip.dbus.introspection", + "slip.dbus.mainloop", "slip.dbus.polkit", "slip.dbus.proxies", + "slip.dbus.service"], +- requires=["dbus", "decorator", "StringIO", "xml.etree.ElementTree"]) ++ requires=["dbus", "decorator", "selinux", "StringIO", "xml.etree.ElementTree"]) + + if sys.version_info.major == 2: + setup(name="slip.gtk", version="@VERSION@", diff --git a/meta-python/recipes-devtools/python/python3-slip-dbus/9b939c0b534c1b7958fa0a3c7aedf30bca910431.patch b/meta-python/recipes-devtools/python/python3-slip-dbus/9b939c0b534c1b7958fa0a3c7aedf30bca910431.patch new file mode 100644 index 0000000000..b0e9d2215f --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-slip-dbus/9b939c0b534c1b7958fa0a3c7aedf30bca910431.patch @@ -0,0 +1,76 @@ +From 9b939c0b534c1b7958fa0a3c7aedf30bca910431 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 7 Jun 2021 23:23:47 +0200 +Subject: [PATCH] Python 3.10+ fix: Use collections.abc.Callable instead of + collections.Callable + +The deprecated aliases to Collections Abstract Base Classes were removed from +the collections module in Python 3.10. +https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-0-alpha-5 +https://bugs.python.org/issue37324 +--- + slip/dbus/polkit.py | 6 +++--- + slip/util/hookable.py | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/slip/dbus/polkit.py b/slip/dbus/polkit.py +index 128e8ce..320676d 100644 +--- a/slip/dbus/polkit.py ++++ b/slip/dbus/polkit.py +@@ -26,7 +26,7 @@ + + from __future__ import absolute_import + +-import collections ++import collections.abc + import dbus + from decorator import decorator + from functools import reduce +@@ -103,14 +103,14 @@ class MyProxy(object): + def some_method(self, ...): + ...""" + +- assert(func is None or isinstance(func, collections.Callable)) ++ assert(func is None or isinstance(func, collections.abc.Callable)) + + assert( + authfail_result in (None, AUTHFAIL_DONTCATCH) or + authfail_exception is None) + assert( + authfail_callback is None or +- isinstance(authfail_callback, collections.Callable)) ++ isinstance(authfail_callback, collections.abc.Callable)) + assert( + authfail_exception is None or + issubclass(authfail_exception, Exception)) +diff --git a/slip/util/hookable.py b/slip/util/hookable.py +index 89c7392..0cd9967 100644 +--- a/slip/util/hookable.py ++++ b/slip/util/hookable.py +@@ -23,7 +23,7 @@ + """This module contains variants of certain base types which call registered + hooks on changes.""" + +-import collections ++import collections.abc + from six import with_metaclass + + __all__ = ["Hookable", "HookableSet"] +@@ -67,7 +67,7 @@ class _HookEntry(object): + + def __init__(self, hook, args, kwargs, hookable=None): + +- assert(isinstance(hook, collections.Callable)) ++ assert(isinstance(hook, collections.abc.Callable)) + assert(isinstance(hookable, Hookable)) + + for n, x in enumerate(args): +@@ -174,7 +174,7 @@ def add_hook_hookable(self, hook, *args, **kwargs): + self.__add_hook(hook, self, *args, **kwargs) + + def __add_hook(self, hook, _hookable, *args, **kwargs): +- assert isinstance(hook, collections.Callable) ++ assert isinstance(hook, collections.abc.Callable) + assert isinstance(_hookable, Hookable) + hookentry = _HookEntry(hook, args, kwargs, hookable=_hookable) + self.__hooks__.add(hookentry) diff --git a/meta-python/recipes-devtools/python/python3-slip-dbus_0.6.5.bb b/meta-python/recipes-devtools/python/python3-slip-dbus_0.6.5.bb index 00d83ab61b..57a9185289 100644 --- a/meta-python/recipes-devtools/python/python3-slip-dbus_0.6.5.bb +++ b/meta-python/recipes-devtools/python/python3-slip-dbus_0.6.5.bb @@ -14,12 +14,14 @@ LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018" SRCNAME = "python-slip" -SRC_URI = "https://github.com/nphilipp/${SRCNAME}/releases/download/${SRCNAME}-${PV}/${SRCNAME}-${PV}.tar.bz2" -S = "${WORKDIR}/${SRCNAME}-${PV}" - -SRC_URI[md5sum] = "28ae5f93853466c44ec96706ba2a1eb4" +SRC_URI = "https://github.com/nphilipp/${SRCNAME}/releases/download/${SRCNAME}-${PV}/${SRCNAME}-${PV}.tar.bz2 \ + file://9b939c0b534c1b7958fa0a3c7aedf30bca910431.patch \ + file://0001-setup.py-Use-setuptools-instead-of-distutils.patch \ + " SRC_URI[sha256sum] = "c726c086f0dd93a0ac7a0176f383a12af91b6657b78a301e3f5b25d9f8d4d10b" +S = "${WORKDIR}/${SRCNAME}-${PV}" + do_compile:prepend() { sed -e 's/@VERSION@/${PV}/g' ${S}/setup.py.in > ${S}/setup.py } @@ -32,3 +34,4 @@ RDEPENDS:${PN} += "\ CLEANBROKEN = "1" inherit setuptools3 +PIP_INSTALL_PACKAGE = "slip"