17
0

- Add patch fix-loglevel.patch to fix invalid log level error.

gh#nima/python-dmidecode#60 bsc#1237685

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dmidecode?expand=0&rev=36
This commit is contained in:
2025-03-03 10:58:13 +00:00
committed by Git OBS Bridge
commit d1c5e7f2ba
13 changed files with 577 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,20 @@
From 3d656cd92a7b19758a17dfa47b4ce13da5b2bb61 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefano@rivera.za.net>
Date: Fri, 19 Nov 2021 12:01:32 -0400
Subject: [PATCH] Support Python 3.10's 2-digit minor version
---
unit-tests/unit | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/unit-tests/unit
+++ b/unit-tests/unit
@@ -9,7 +9,7 @@ from getopt import getopt
# Setup temporary sys.path() with our build dir
(sysname, nodename, release, version, machine) = os.uname()
-pyver = sys.version[:3]
+pyver = '%i.%i' % sys.version_info[:2]
sys.path.insert(0,'../build/lib.%s-%s-%s' % (sysname.lower(), machine, pyver))
root_user = (os.getuid() == 0 and True or False)

15
_service Normal file
View File

@@ -0,0 +1,15 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="versionprefix">3.12.2+git</param>
<param name="url">https://github.com/nima/python-dmidecode.git</param>
<param name="scm">git</param>
<param name="exclude">.git*</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">mcepl@cepl.eu</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled" />
</services>

4
_servicedata Normal file
View File

@@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/nima/python-dmidecode.git</param>
<param name="changesrevision">e6ab5bc3b8b60fd560e411e148f6bf9571feae47</param></service></servicedata>

67
detect-lib-with-py3.patch Normal file
View File

@@ -0,0 +1,67 @@
---
Makefile | 10 ++++------
src/setup_common.py | 9 ++++++---
2 files changed, 10 insertions(+), 9 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -44,12 +44,11 @@ PACKAGE := python-dmidecode
PY_VER := $(shell $(PY_BIN) -c 'import sys; print("%d.%d"%sys.version_info[0:2])')
PY_MV := $(shell echo $(PY_VER) | cut -b 1)
PY := python$(PY_VER)
-SO_PATH := build/lib.linux-$(shell uname -m)-$(PY_VER)
ifeq ($(PY_MV),2)
- SO := $(SO_PATH)/dmidecodemod.so
+ SOLIB := dmidecodemod.so
else
SOABI := $(shell $(PY_BIN) -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))')
- SO := $(SO_PATH)/dmidecodemod.$(SOABI).so
+ SOLIB := dmidecodemod.$(SOABI).so
endif
SHELL := /bin/bash
@@ -59,10 +58,9 @@ SHELL := /bin/bash
all : build dmidump
build: $(PY)-dmidecodemod.so
-$(PY)-dmidecodemod.so: $(SO)
- cp $< $@
-$(SO):
+$(PY)-dmidecodemod.so:
$(PY) src/setup.py build
+ cp $$(find build -name $(SOLIB)) $@
dmidump : src/util.o src/efi.o src/dmilog.o
$(CC) -o $@ src/dmidump.c $^ -g -Wall -D_DMIDUMP_MAIN_
--- a/src/setup_common.py
+++ b/src/setup_common.py
@@ -30,7 +30,7 @@ import subprocess, sys
if sys.version_info[0] < 3:
import commands as subprocess
from os import path as os_path
-from distutils.sysconfig import get_python_lib
+from sysconfig import get_config_var, get_path
# libxml2 - C flags
def libxml2_include(incdir):
@@ -50,7 +50,7 @@ def libxml2_include(incdir):
# libxml2 - library flags
def libxml2_lib(libdir, libs):
- libdir.append(get_python_lib(1))
+ libdir.append(get_path('platlib'))
if os_path.exists("/etc/debian_version"): #. XXX: Debian Workaround...
libdir.append("/usr/lib/pymodules/python%d.%d"%sys.version_info[0:2])
@@ -69,7 +69,10 @@ def libxml2_lib(libdir, libs):
libs.append(l.replace("-l", "", 1))
# this library is not reported and we need it anyway
- libs.append('xml2mod')
+ if get_config_var("SOABI"):
+ libs.append('xml2mod.%s' % get_config_var("SOABI"))
+ else:
+ libs.append('xml2mod')

12
fix-loglevel.patch Normal file
View File

@@ -0,0 +1,12 @@
diff --color -Naur python-dmidecode-3.12.3-orig/src/efi.c python-dmidecode-3.12.3/src/efi.c
--- python-dmidecode-3.12.3-orig/src/efi.c 2022-11-17 06:51:28
+++ python-dmidecode-3.12.3/src/efi.c 2025-02-25 14:25:32
@@ -84,7 +84,7 @@
}
if(ret == 0){
- log_append(logp, LOGFL_NODUPS, LOG_DEBUG, "%s: entry point at 0x%08llx", eptype, (unsigned long long)*address);
+ log_append(logp, LOGFL_NODUPS, LOG_WARNING, "%s: entry point at 0x%08llx", eptype, (unsigned long long)*address);
}
return ret;

74
gcc14.patch Normal file
View File

@@ -0,0 +1,74 @@
Index: python-dmidecode-3.12.3/src/dmidecodemodule.c
===================================================================
--- python-dmidecode-3.12.3.orig/src/dmidecodemodule.c
+++ python-dmidecode-3.12.3/src/dmidecodemodule.c
@@ -54,13 +54,13 @@
#include <mcheck.h>
#if (PY_VERSION_HEX < 0x03030000)
-char *PyUnicode_AsUTF8(PyObject *unicode) {
+const char *PyUnicode_AsUTF8(PyObject *unicode) {
PyObject *as_bytes = PyUnicode_AsUTF8String(unicode);
if (!as_bytes) {
return NULL;
}
- return PyBytes_AsString(as_bytes);
+ return (const char*)PyBytes_AsString(as_bytes);
}
#endif
@@ -479,7 +479,7 @@ xmlNode *__dmidecode_xml_getsection(opti
if(opt->type == -1) {
char *err = log_retrieve(opt->logdata, LOG_ERR);
log_clear_partial(opt->logdata, LOG_ERR, 0);
- _pyReturnError(PyExc_RuntimeError, "Invalid type id '%s' -- %s", typeid, err);
+ PyReturnError(PyExc_RuntimeError, "Invalid type id '%s' -- %s", typeid, err);
free(err);
return NULL;
}
@@ -657,7 +657,7 @@ static PyObject *dmidecode_get_slot(PyOb
static PyObject *dmidecode_get_section(PyObject *self, PyObject *args)
{
- char *section = NULL;
+ const char *section = NULL;
if (PyUnicode_Check(args)) {
section = PyUnicode_AsUTF8(args);
} else if (PyBytes_Check(args)) {
@@ -788,7 +788,7 @@ static PyObject *dmidecode_get_dev(PyObj
static PyObject *dmidecode_set_dev(PyObject * self, PyObject * arg)
{
- char *f = NULL;
+ const char *f = NULL;
if(PyUnicode_Check(arg)) {
f = PyUnicode_AsUTF8(arg);
} else if(PyBytes_Check(arg)) {
@@ -835,7 +835,7 @@ static PyObject *dmidecode_set_dev(PyObj
static PyObject *dmidecode_set_pythonxmlmap(PyObject * self, PyObject * arg)
{
- char *fname = NULL;
+ const char *fname = NULL;
if (PyUnicode_Check(arg)) {
fname = PyUnicode_AsUTF8(arg);
@@ -913,7 +913,7 @@ static PyMethodDef DMIDataMethods[] = {
{(char *)"pythonmap", dmidecode_set_pythonxmlmap, METH_O,
(char *) "Use another python dict map definition. The default file is " PYTHON_XML_MAP},
- {(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS,
+ {(char *)"xmlapi", (PyCFunction)dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS,
(char *) "Internal API for retrieving data as raw XML data"},
@@ -1024,7 +1024,7 @@ initdmidecodemod(void)
// Assign this options struct to the module as well with a destructor, that way it will
// clean up the memory for us.
// TODO: destructor has wrong type under py3?
- PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, destruct_options));
+ PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, (PyCapsule_Destructor)destruct_options));
global_options = opt;
#ifdef IS_PY3K
return module;

24
gcc7-inline.patch Normal file
View File

@@ -0,0 +1,24 @@
---
src/dmixml.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/src/dmixml.c
+++ b/src/dmixml.c
@@ -362,7 +362,7 @@ xmlNode *dmixml_FindNode(xmlNode *node,
* @return char* Pointer to the tag contents if found, otherwise NULL. This value
* must NOT be freed, as it points directly into the value in the XML document.
*/
-inline char *dmixml_GetContent(xmlNode *node) {
+char *dmixml_GetContent(xmlNode *node) {
// FIXME: Should find better way how to return UTF-8 data
return (((node != NULL) && (node->children != NULL)) ? (char *) node->children->content : NULL);
}
@@ -377,7 +377,7 @@ inline char *dmixml_GetContent(xmlNode *
* @return char* Pointer to the tag contents if found, otherwise NULL. This value
* must NOT be freed, as it points directly into the value in the XML document.
*/
-inline char *dmixml_GetNodeContent(xmlNode *node, const char *key) {
+char *dmixml_GetNodeContent(xmlNode *node, const char *key) {
return dmixml_GetContent(dmixml_FindNode(node, key));
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:44d45d7d8344290c259c989d3af3f614c7837cbd85052d486adfa46a1c777164
size 156670

212
python-dmidecode.changes Normal file
View File

@@ -0,0 +1,212 @@
-------------------------------------------------------------------
Mon Mar 3 10:46:32 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
- Add patch fix-loglevel.patch to fix invalid log level error.
gh#nima/python-dmidecode#60 bsc#1237685
-------------------------------------------------------------------
Tue Oct 22 06:56:53 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Add gcc14.patch to make it compatible with gcc14
gh#nima/python-dmidecode#59
-------------------------------------------------------------------
Tue Feb 13 12:46:21 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Add setuptools buildrequires, distutils is not part of python-base
from python 3.12+
-------------------------------------------------------------------
Fri Apr 21 12:24:18 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:40:56 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Tue Mar 14 10:32:01 UTC 2023 - Matej Cepl <mcepl@suse.com>
- In the end just a cosmetical changes and cleaning up the SPEC
file.
-------------------------------------------------------------------
Sat Nov 19 20:37:12 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Update to the upstream release 3.12.3:
- consolidation of previous git commits
- support SMBIOS3.3.0
- Remove upstreamed huge-memory.patch
-------------------------------------------------------------------
Wed Oct 26 15:51:25 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Modify detect-lib-with-py3.patch to be more robust.
-------------------------------------------------------------------
Wed Oct 26 09:14:38 UTC 2022 - mcepl@cepl.eu
- Update to version 3.12.2+git.1666757106.e6ab5bc:
* fix address_from_efi ret=0 message
* fix function dmi_slot_segment_bus_func null point error in system slot
* fix warning: this 'if' clause does not guard
* fix warning: variable 'str_n' set but not used
* fix warning: passing argument 2 of 'dmi_tpm_vendor_id' makes pointer from integer without a cast
* fix warning: unused variable 'attr'
* fix warning: unused variable 'addrstr'
* fix warning: suggest parentheses around assignment used as truth value
* fix warning: suggest parentheses around assignment used as truth value
* src/dmidecode.c: In function 'dmi_tpm_characteristics': src/dmidecode.c:4788:24: warning: 'return' with a value, in function returning void [-Wreturn-type] 4788 | return data_n; | ^~~~~~
* fix warning: passing argument 3 of 'dmi_slot_peers' from incompatible pointer type
* fix warning: unused variable 'ver'
* fix warning: variable 'eptype' set but not used
* fix warning: suggest parentheses around '&&' within '||'
* fix warning: comparison of integer expressions of different signedness
* fix warning: ignoring return value of 'legacy_decode'
* fix warning argument 1 null where non-null expected
* Update python-dmidecode to smbios 3.3.0
* Fix for printing an empty dictionary
* Fix the failure of opening "/dev/mem": Permission denied
* Fix bugs: 1. Fix smbios3_decode decoding sysfs table dump error. 2. Fix check smbios version error warning message.
* Fix reading info permission deny bugs.
- Remove duplicated Makefile_libdir.patch.
-------------------------------------------------------------------
Mon Oct 17 18:05:41 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add Makefile_libdir.patch to make package building even with
faulty distutils.sysconfig (bsc#1204395).
-------------------------------------------------------------------
Fri May 20 15:07:23 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Synchronize SPEC file to be more like the SLE one.
-------------------------------------------------------------------
Mon Mar 7 13:44:33 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add missing Obsoletes
-------------------------------------------------------------------
Fri Mar 4 09:24:04 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Harmonize Factory with the SLE version (update-alternatives
instead of the subpackages).
-------------------------------------------------------------------
Mon Feb 28 10:41:11 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add proper Provides/Obsoletes
-------------------------------------------------------------------
Thu Feb 24 22:57:21 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Cleanup multi-version builds.
-------------------------------------------------------------------
Thu Feb 24 21:15:44 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Introduce update-alternatives for
/usr/share/python-dmidecode/pymap.xml.
-------------------------------------------------------------------
Thu Feb 24 06:32:14 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Fix package names.
-------------------------------------------------------------------
Sat Dec 04 00:01:25 UTC 2021 - mcepl@cepl.eu
- Update to version 3.12.2+git.1625035095.f0a089a:
* fix "src/dmidecodemodule.c:828:9 warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where non-null expected"
* fix Error: FORWARD_NULL (CWE-476): [#def23]
* fix "src/dmierror.c:55:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL buf where non-null expected"
* fix Error: MISSING_COMMA: detected by covscan
* fix Error: CONSTANT_EXPRESSION_RESULT detected by covscan
* fix RESOURCE_LEAK error detected by covscan in src/util.c
* fix RESOURCE_LEAK errors detected by covscan in src/xmlpythonizer.c
* Update README
* fix RESOURCE_LEAK errors detected by covscan in src/dmidecodemodule.c
* Fixed memory Type Detail map size (bsc#1194351).
-------------------------------------------------------------------
Thu Dec 2 23:52:35 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Brutal simplification of the SPEC file to the standard single-spec
Python one.
- Removal of support for Python 2 (bsc#1193262)
- Rename huge-memory.diff to huge-memory.patch (i.e., remove
huge-memory.diff and add huge-memory.patch).
- Fix URL of Source0 (their own website is down, use GitHub
release).
- Add 31-version_info-v-version.patch to make tests 3.10
compatible.
-------------------------------------------------------------------
Thu Oct 19 07:53:52 UTC 2017 - mc@suse.com
- build python2-dmidecode and use python-dmidecode for shared files
-------------------------------------------------------------------
Tue Oct 17 13:05:04 UTC 2017 - mc@suse.com
- set rpath to libxml2mod library
-------------------------------------------------------------------
Sun Sep 24 14:05:44 UTC 2017 - mc@suse.com
- version 3.12.2
- Add Python 3 subpackage
- Removed deprecated statements
-------------------------------------------------------------------
Wed May 3 15:12:27 CEST 2017 - mantel@suse.de
- use correct data type DWORD for extended memory size (bsc#1036061)
-------------------------------------------------------------------
Wed Sep 3 01:41:37 CEST 2014 - ro@suse.de
- sanitize release line in specfile
-------------------------------------------------------------------
Fri Jan 17 17:12:10 CET 2014 - mc@suse.de
- version 3.12.1
obsoleted patches (available in new upstream version):
* python-dmidecode_copyright-update.patch
* bug-713982_python-dmidecode-nullversion.patch
* python-dmidecode-dmixml-error-63fa74b229dd2.patch
* bug-823328-fix-set_vendor-segfault.dif
- Add SIGILL catcher in mem_chunk()
- Implemented dmixml_AddDMIstring()
- Harden dmi_string() calls with better NULL checks
- Do not add explictly 'dmispec' attributes inside switch()
in dmi_decode()
- rebase against upstream dmidecode v2.12 and an update
against the SMBIOS reference specification v2.8.0.
-------------------------------------------------------------------
Tue Jun 11 18:38:23 CEST 2013 - mc@suse.de
- fix segfault in dmi_set_vendor (bnc#823328)
-------------------------------------------------------------------
Wed Sep 28 13:16:17 CEST 2011 - mc@suse.de
- fix dmi_decode assertion during client registration
(bnc#720885)
-------------------------------------------------------------------
Mon Sep 12 11:05:55 CEST 2011 - mc@suse.de
- fix Segfault when decoding DMI data in dmi_processor_id()
(bnc#713982)
-------------------------------------------------------------------
Thu Dec 9 14:15:15 CET 2010 - mc@suse.de
- initial release

View File

@@ -0,0 +1 @@
addFilter("obsolete-not-provided")

121
python-dmidecode.spec Normal file
View File

@@ -0,0 +1,121 @@
#
# spec file for package python-dmidecode
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define oldpython python
%define modname dmidecode
%{?sle15_python_module_pythons}
Name: python-dmidecode
Version: 3.12.3
Release: 0
Summary: Python module to access DMI data
License: GPL-2.0-only
Group: System/Libraries
URL: https://github.com/nima/python-dmidecode
Source0: https://github.com/nima/python-dmidecode/archive/refs/tags/v%{version}.tar.gz#/python-dmidecode-%{version}.tar.gz
Source99: python-dmidecode.rpmlintrc
# PATCH-FIX-UPSTREAM gcc7-inline.patch gh#nima/python-dmidecode#35 mcepl@suse.com
# Don't use inline keyword.
Patch1: gcc7-inline.patch
# PATCH-FIX-UPSTREAM 31-version_info-v-version.patch gh#nima/python-dmidecode#31 mcepl@suse.com
# use sys.version_info instead of sys.version
Patch2: 31-version_info-v-version.patch
# PATCH-FIX-UPSTREAM detect-lib-with-py3.patch gh#nima/python-dmidecode#36 mcepl@suse.com
# Make the code future-proof against removal of distutils module.
Patch3: detect-lib-with-py3.patch
# PATCH-FIX-UPSTREAM gcc14.patch gh#nima/python-dmidecode#59 -- daniel.garcia@suse.com
Patch4: gcc14.patch
# PATCH-FIX-OPENSUSE fix-loglevel.patch gh#nima/python-dmidecode#60
Patch5: fix-loglevel.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: libxml2-devel
BuildRequires: python-rpm-macros
Requires: python
Requires(post): update-alternatives
Requires(postun): update-alternatives
Obsoletes: %{oldpython}-dmidecode <= %{version}
Obsoletes: python-python-dmidecode <= %{version}
%if 0%{?sle_version} >= 150400 || 0%{?suse_version} >= 1550
BuildRequires: %{python_module libxml2}
%else
BuildRequires: python2-libxml2-python
BuildRequires: python3-libxml2-python
%endif
%python_subpackages
%description
python-dmidecode is a python extension module that uses the code-base
of the 'dmidecode' utility, and presents the data as python data
structures or as XML data using libxml2.
%prep
%autosetup -p1
%build
export CFLAGS="%{optflags}"
%{python_expand export LDFLAGS="-Wl,-rpath=%{$python_sitearch}"
%make_build PY_BIN=$python build
}
%install
%{python_expand rm -f %{buildroot}%{_datadir}/python-dmidecode/pymap.xml
$python src/setup.py install --root %{buildroot} --prefix=%{_prefix}
# prepare alternatives
install -d %{buildroot}%{_sysconfdir}/alternatives
mv %{buildroot}%{_datadir}/python-dmidecode/pymap{,-%{$python_bin_suffix}}.xml
touch %{buildroot}%{_sysconfdir}/alternatives/pymap.xml
ln -s %{_sysconfdir}/alternatives/pymap.xml \
%{buildroot}%{_datadir}/python-dmidecode/pymap.xml
%fdupes %{buildroot}%{$python_sitearch}
}
%check
pushd unit-tests
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
%make_build PY_BIN=$python
}
popd
%post
PRIO=$(echo %{python_version}|tr -d '.')
%{_sbindir}/update-alternatives --install %{_datadir}/python-dmidecode/pymap.xml pymap.xml \
%{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml ${PRIO}
%postun
if [ ! -f %{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml ] ; then
MAJVER=$(ver=%{python_version}; echo ${ver:0:1})
%{_sbindir}/update-alternatives --remove pymap.xml \
%{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml
fi
%files %{python_files}
%license doc/LICENSE
%doc README doc/README.upstream doc/AUTHORS doc/AUTHORS.upstream
%dir %{_datadir}/python-dmidecode/
%ghost %{_sysconfdir}/alternatives/pymap.xml
%ghost %{_datadir}/python-dmidecode/pymap.xml
%{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml
# %%{python_sitearch}/python_dmidecode-%%{version}*-info
%{python_sitearch}/python_dmidecode-3.12.2*-info
%{python_sitearch}/dmidecode.py
%{python_sitearch}/dmidecodemod.*.so
%pycache_only %{python_sitearch}/__pycache__/dmidecode*.pyc
%changelog