diff --git a/.gitignore b/.gitignore index 054abe4..362f325 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ python-dmidecode-3.10.13.tar.gz python-dmidecode-3.10.13.tar.xz /python-dmidecode-3.12.2.tar.gz /python-dmidecode-f0a089a12dca9e2fd9543c8e8086ac70f7058513.tar.gz +/python-dmidecode-3.12.3.tar.gz diff --git a/python-dmidecode-rhbz2154949.patch b/python-dmidecode-rhbz2154949.patch new file mode 100644 index 0000000..ae86f99 --- /dev/null +++ b/python-dmidecode-rhbz2154949.patch @@ -0,0 +1,142 @@ +From 2d6530941682595b26067a8b679ec2eb3aceae54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= +Date: Tue, 17 May 2022 16:00:47 +0200 +Subject: [PATCH 1/3] Make the code future-proof against removal of distutils + module. + +--- + src/setup_common.py | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/setup_common.py b/src/setup_common.py +index aec1f9b..3fb9086 100644 +--- a/src/setup_common.py ++++ b/src/setup_common.py +@@ -30,7 +30,12 @@ + if sys.version_info[0] < 3: + import commands as subprocess + from os import path as os_path +-from distutils.sysconfig import get_python_lib ++try: ++ from distutils.sysconfig import get_python_lib, get_config_var ++ __python_lib = get_python_lib(1) ++except ImportError: ++ from sysconfig import get_config_var, get_path ++ __python_lib = get_path('platlib') + + # libxml2 - C flags + def libxml2_include(incdir): +@@ -50,7 +55,7 @@ def libxml2_include(incdir): + + # libxml2 - library flags + def libxml2_lib(libdir, libs): +- libdir.append(get_python_lib(1)) ++ libdir.append(__python_lib) + if os_path.exists("/etc/debian_version"): #. XXX: Debian Workaround... + libdir.append("/usr/lib/pymodules/python%d.%d"%sys.version_info[0:2]) + +From 7c0788b5c5ed7d1c79f70a74047abab161dca13a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= +Date: Mon, 17 Oct 2022 19:59:52 +0200 +Subject: [PATCH 2/3] Don't be too complicated. + +There is actually no reason to use distutils.sysconfig at all, +plain sysconfig works even on 2.7. +--- + Makefile | 3 ++- + src/setup_common.py | 9 ++------- + 2 files changed, 4 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index 2f47a75..6a12073 100644 +--- a/Makefile ++++ b/Makefile +@@ -42,9 +42,10 @@ PY_BIN := python3 + VERSION := $(shell cd src;$(PY_BIN) -c "from setup_common import *; print(get_version());") + PACKAGE := python-dmidecode + PY_VER := $(shell $(PY_BIN) -c 'import sys; print("%d.%d"%sys.version_info[0:2])') ++PY_VER_DL := $(shell echo $(PY_VER) | tr -d '.') + PY_MV := $(shell echo $(PY_VER) | cut -b 1) + PY := python$(PY_VER) +-SO_PATH := build/lib.linux-$(shell uname -m)-$(PY_VER) ++SO_PATH := build/lib.linux-$(shell uname -m)-cpython-$(PY_VER_DL) + ifeq ($(PY_MV),2) + SO := $(SO_PATH)/dmidecodemod.so + else +diff --git a/src/setup_common.py b/src/setup_common.py +index 3fb9086..97ece95 100644 +--- a/src/setup_common.py ++++ b/src/setup_common.py +@@ -30,12 +30,7 @@ + if sys.version_info[0] < 3: + import commands as subprocess + from os import path as os_path +-try: +- from distutils.sysconfig import get_python_lib, get_config_var +- __python_lib = get_python_lib(1) +-except ImportError: +- from sysconfig import get_config_var, get_path +- __python_lib = get_path('platlib') ++from sysconfig import get_config_var, get_path + + # libxml2 - C flags + def libxml2_include(incdir): +@@ -55,7 +50,7 @@ def libxml2_include(incdir): + + # libxml2 - library flags + def libxml2_lib(libdir, libs): +- libdir.append(__python_lib) ++ 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]) + + +From 860c730309366d6062c410ee975a2fc159452dc6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= +Date: Wed, 26 Oct 2022 17:39:47 +0200 +Subject: [PATCH 3/3] Make the discovery of the build .so file more robust. + +Different versions of Python apparently generate different +directory names, there doesn't seem to be any more reliable +method of the .so file discovery than brutal force of the shell +find command. +--- + Makefile | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 6a12073..06e83f0 100644 +--- a/Makefile ++++ b/Makefile +@@ -42,15 +42,13 @@ PY_BIN := python3 + VERSION := $(shell cd src;$(PY_BIN) -c "from setup_common import *; print(get_version());") + PACKAGE := python-dmidecode + PY_VER := $(shell $(PY_BIN) -c 'import sys; print("%d.%d"%sys.version_info[0:2])') +-PY_VER_DL := $(shell echo $(PY_VER) | tr -d '.') + PY_MV := $(shell echo $(PY_VER) | cut -b 1) + PY := python$(PY_VER) +-SO_PATH := build/lib.linux-$(shell uname -m)-cpython-$(PY_VER_DL) + 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 + +@@ -60,10 +58,10 @@ 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_ diff --git a/python-dmidecode-use_python3.patch b/python-dmidecode-use_python3.patch deleted file mode 100644 index 0cda00d..0000000 --- a/python-dmidecode-use_python3.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/Makefile.orig 2020-11-26 17:05:32.097857000 +0100 -+++ b/Makefile 2020-11-26 17:09:31.660779877 +0100 -@@ -38,8 +38,8 @@ - #. $AutoHeaderSerial::20100225 $ - #. ******* AUTOHEADER END v1.2 ******* - --PY_BIN := python3 --VERSION := $(shell cd src;$(PY_BIN) -c "from setup_common import *; print(get_version());") -+PY_BIN := $(PYTHON_BIN) -+VERSION := $(PYTHON_VERSION) - 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) -@@ -65,7 +65,7 @@ - $(PY) src/setup.py build - - dmidump : src/util.o src/efi.o src/dmilog.o -- $(CC) -o $@ src/dmidump.c $^ -g -Wall -D_DMIDUMP_MAIN_ -+ $(CC) -o $@ src/dmidump.c $^ $(CFLAGS) -D_DMIDUMP_MAIN_ - - install: - $(PY) src/setup.py install ---- a/unit-tests/Makefile.orig 2015-06-08 17:19:45.000000000 +0200 -+++ b/unit-tests/Makefile 2020-11-26 17:12:15.222361106 +0100 -@@ -1,5 +1,5 @@ --PY_BIN := python3 -+PY_BIN := $(PYTHON_BIN) - - test : - $(PY_BIN) unit -vv - diff --git a/python-dmidecode.spec b/python-dmidecode.spec index 4ddc136..9811dec 100644 --- a/python-dmidecode.spec +++ b/python-dmidecode.spec @@ -1,23 +1,33 @@ +%global gitver 0 + +%if 0%{?gitver} %global commit f0a089a12dca9e2fd9543c8e8086ac70f7058513 %global date .20210630git %global shortcommit %(c=%{commit}; echo ${c:0:8}) +%else +%global commit %{nil} +%global date %{nil} +%global shortcommit %{nil} +%endif Name: python-dmidecode Summary: Python module to access DMI data -Version: 3.12.2 -Release: 29%{date}%{shortcommit}%{?dist} +Version: 3.12.3 +Release: 1%{date}%{shortcommit}%{?dist} License: GPLv2 URL: https://github.com/nima/python-dmidecode -Source0: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz +Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz -Patch0: python-dmidecode-use_python3.patch +Patch0: python-dmidecode-rhbz2154949.patch BuildRequires: make BuildRequires: gcc BuildRequires: libxml2-devel - BuildRequires: python3-devel BuildRequires: libxml2-python3 +%if 0%{?python3_version_nodots} >= 312 +BuildRequires: python3-setuptools +%endif %global _description\ python-dmidecode is a python extension module that uses the\ @@ -36,15 +46,16 @@ Requires: libxml2-python3 %prep -%autosetup -n %{name}-%{commit} -N +%autosetup -n %{name}-%{version} -N %patch0 -p1 -b .backup %build # -std=gnu89 is there to avoid `undefined symbol: dmixml_GetContent` export PYTHON_BIN=%{__python3} -export PYTHON_VERSION=%{python3_version} export CFLAGS="%{build_cflags} -std=gnu89" +export CXXFLAGS="%{build_cxxflags} -std=gnu89" export CC=gcc +export CXX=g++ %make_build %install @@ -61,12 +72,15 @@ make -C unit-tests %license doc/LICENSE %doc README doc/AUTHORS doc/AUTHORS.upstream %{python3_sitearch}/dmidecodemod.cpython-%{python3_version_nodots}*.so -%{python3_sitearch}/__pycache__/dmidecode.cpython-%{python3_version_nodots}*.py[co] -%{python3_sitearch}/dmidecode.py +%pycached %{python3_sitearch}/dmidecode.py %{python3_sitearch}/*.egg-info -%{_datadir}/python-dmidecode/ +%{_datadir}/%{name}/ %changelog +* Sun Dec 25 2022 Antonio Trande - 3.12.3-1 +- Release 3.12.3 +- Temporary fix for rhbz#2154949 + * Fri Jul 22 2022 Fedora Release Engineering - 3.12.2-29.20210630gitf0a089a1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 8830b3c..d4493cc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (python-dmidecode-f0a089a12dca9e2fd9543c8e8086ac70f7058513.tar.gz) = 63cf1e51d5864c2490d677cf9808608434a58e0ca401727bf82ad2609a29ef66b19768735ecabaf007b2837ccf6c78f4268d2d7c3aab93f1dac0f35cc7a44492 +SHA512 (python-dmidecode-3.12.3.tar.gz) = b9436236851f9a225340279e50ae3a4a8def10e5a75d918d7b1cf77c8c2213632acd72ece58eaf09f2dc5f26d93ce44d9da9249182bb00147ed9249cd40449cf