From afa14e0e475ecc590faf5ae7b1ed940fc287ad29fbe67fa39e911e529b73d4d5 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 17 Aug 2022 09:04:07 +0000 Subject: [PATCH] - Add OBS_missing_etc_machine_id.patch to partially fix gh#systemd/python-systemd#118. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-systemd?expand=0&rev=24 --- OBS_missing_etc_machine_id.patch | 39 ++++++++++++++++++++++++++++++++ python-systemd.changes | 6 +++++ python-systemd.spec | 12 ++++++---- 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 OBS_missing_etc_machine_id.patch diff --git a/OBS_missing_etc_machine_id.patch b/OBS_missing_etc_machine_id.patch new file mode 100644 index 0000000..63246cb --- /dev/null +++ b/OBS_missing_etc_machine_id.patch @@ -0,0 +1,39 @@ +From 50d1ec8ab8d3333ef1b7cac982155b94c7534c4c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Wed, 17 Aug 2022 09:53:25 +0200 +Subject: [PATCH] tests: check for errnos that sd_id128_get_machine actually + returns + +Fixes #118. +--- + systemd/test/test_id128.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/systemd/test/test_id128.py b/systemd/test/test_id128.py +index 146ec73..f5fc65f 100644 +--- a/systemd/test/test_id128.py ++++ b/systemd/test/test_id128.py +@@ -6,11 +6,11 @@ + from systemd import id128 + + @contextlib.contextmanager +-def skip_oserror(code): ++def skip_oserror(*errnos): + try: + yield + except (OSError, IOError) as e: +- if e.errno == code: ++ if e.errno in errnos: + pytest.skip() + raise + +@@ -29,7 +29,8 @@ def test_get_machine_app_specific(): + a1 = uuid.uuid1() + a2 = uuid.uuid1() + +- with skip_oserror(errno.ENOSYS): ++ # yikes, python2 doesn't know ENOMEDIUM ++ with skip_oserror(errno.ENOENT, 123): + u1 = id128.get_machine_app_specific(a1) + + u2 = id128.get_machine_app_specific(a2) diff --git a/python-systemd.changes b/python-systemd.changes index 5282bdb..1aceae5 100644 --- a/python-systemd.changes +++ b/python-systemd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 17 09:03:29 UTC 2022 - Matej Cepl + +- Add OBS_missing_etc_machine_id.patch to partially fix + gh#systemd/python-systemd#118. + ------------------------------------------------------------------- Wed Aug 17 05:49:41 UTC 2022 - Matej Cepl diff --git a/python-systemd.spec b/python-systemd.spec index 98f7d55..e4ec3ce 100644 --- a/python-systemd.spec +++ b/python-systemd.spec @@ -27,8 +27,13 @@ URL: https://github.com/systemd/python-systemd Source: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz # PATCH-FIX-OPENSUSE iso-c-90.patch makes the building iso-c-90 compatible to allow building on SLE12 SP3 Patch1: iso-c-90.patch +# PATCH-FIX-OPENSUSE OBS_missing_etc_machine_id.patch gh#systemd/python-systemd#118 mcepl@suse.com +# build environment doesn't have /etc/machine-id +Patch2: OBS_missing_etc_machine_id.patch BuildRequires: %{python_module devel} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: pkgconfig @@ -51,16 +56,15 @@ Python module for native access to the systemd facilities. Functionality is sepe %autosetup -p1 %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitearch} %check # Not sure about the first exclusion, -# the following ones are gh#systemd/python-systemd#118 -export PYTEST_ADDOPTS="-k 'not (test_reader_this_machine or test_get_machine or test_get_machine_app_specific)'" +export PYTEST_ADDOPTS="-k 'not (test_reader_this_machine or test_get_machine)'" %python_expand make PYTHON=python%{$python_version} check %files %{python_files}