[meta-oe,2/2] python3-gammu: add recipe for v3.2.4

Message ID 20220114032006.2521012-2-tim.orling@konsulko.com
State New
Headers show
Series [meta-oe,1/2] gammu: upgrade 1.32.0 -> 1.42.0 | expand

Commit Message

Tim Orling Jan. 14, 2022, 3:20 a.m. UTC
The Python bindings for gammu have been moved into a separate package
python-gammu.

Send patch upstream to replace distutils.version.StrictVersion with
packaging.version.parse and .Version

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 ...p.py-StrictVersion-packaging.version.patch | 49 +++++++++++++++++++
 .../gammu/python3-gammu_3.2.4.bb              | 21 ++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/gammu/python3-gammu/0001-setup.py-StrictVersion-packaging.version.patch
 create mode 100644 meta-oe/recipes-connectivity/gammu/python3-gammu_3.2.4.bb

Patch

diff --git a/meta-oe/recipes-connectivity/gammu/python3-gammu/0001-setup.py-StrictVersion-packaging.version.patch b/meta-oe/recipes-connectivity/gammu/python3-gammu/0001-setup.py-StrictVersion-packaging.version.patch
new file mode 100644
index 000000000..23fe4441d
--- /dev/null
+++ b/meta-oe/recipes-connectivity/gammu/python3-gammu/0001-setup.py-StrictVersion-packaging.version.patch
@@ -0,0 +1,49 @@ 
+From 96e8f0b2d13e890d9ffff8673f18dcc94290efb2 Mon Sep 17 00:00:00 2001
+From: Tim Orling <tim.orling@konsulko.com>
+Date: Thu, 13 Jan 2022 20:06:33 -0600
+Subject: [PATCH] setup.py: StrictVersion -> packaging.version.*
+
+distutils is deprecated in Python 3.10 and will be removed in Python
+3.12 [1]
+
+The recommended replacement for distutils.version is to use
+packaging.version
+
+StrictVersion can be replaced by packaging.version.Version and helpers
+like packaging.version.parse()
+
+[1] https://www.python.org/dev/peps/pep-0632/
+[2] https://packaging.pypa.io/en/latest/version.html
+
+Upstream-Status: Submitted [https://github.com/gammu/python-gammu/pull/67]
+
+Signed-off-by: Tim Orling <tim.orling@konsulko.com>
+---
+ setup.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index a458181..bffb09d 100755
+--- a/setup.py
++++ b/setup.py
+@@ -30,7 +30,7 @@ import os
+ import platform
+ import subprocess
+ import sys
+-from distutils.version import StrictVersion
++from packaging.version import parse, Version
+ 
+ from setuptools import Extension, setup
+ 
+@@ -112,9 +112,9 @@ class GammuConfig:
+         with open(self.config_path(self.path)) as handle:
+             for line in handle:
+                 if line.startswith("#define GAMMU_VERSION "):
+-                    version = line.split('"')[1]
++                    version = parse(line.split('"')[1])
+ 
+-        if version is None or StrictVersion(version) < StrictVersion(GAMMU_REQUIRED):
++        if version is None or version < parse(GAMMU_REQUIRED):
+             print("Too old Gammu version, please upgrade!")
+             sys.exit(100)
+ 
diff --git a/meta-oe/recipes-connectivity/gammu/python3-gammu_3.2.4.bb b/meta-oe/recipes-connectivity/gammu/python3-gammu_3.2.4.bb
new file mode 100644
index 000000000..1fdb76eeb
--- /dev/null
+++ b/meta-oe/recipes-connectivity/gammu/python3-gammu_3.2.4.bb
@@ -0,0 +1,21 @@ 
+SUMMARY = "Gammu bindings for Python"
+DESCRIPTION ="Python bindings for the Gammu library."
+HOMEPAGE = "https://wammu.eu/python-gammu/"
+BUGRACKER = "https://github.com/gammu/python-gammu/issues"
+LICENSE = "GPL-2.0-or-later"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+PYPI_PACKAGE = "python-gammu"
+
+inherit pypi setuptools3 pkgconfig
+
+SRC_URI += "file://0001-setup.py-StrictVersion-packaging.version.patch"
+SRC_URI[sha256sum] = "49fc70f01bc192c43ff3ec815e082df5261ea4c8d36a695e977734c4eb4df868"
+
+S = "${WORKDIR}/python-gammu-${PV}"
+
+DEPENDS += "gammu python3-packaging-native"
+
+RDEPENDS:${PN} += "python3-asyncio python3-core python3-threading"
+
+RRECOMMENDS:${PN} += "gammu"