python-dmidecode
python-dmidecode copied to clipboard
Build issue with python 3.10
Hi,
I think it started to happen around python-3.10.8 (might be 3.10.7 as well).
cp build/lib.linux-x86_64-3.10/dmidecodemod.cpython-310-x86_64-linux-gnu.so python3.10-dmidecodemod.so
cp: cannot stat 'build/lib.linux-x86_64-3.10/dmidecodemod.cpython-310-x86_64-linux-gnu.so': No such file or directory
make: *** [Makefile:63: python3.10-dmidecodemod.so] Error 1
The correct name for output library is build/lib.linux-x86_64-cpython-310/dmidecodemod.cpython-310-x86_64-linux-gnu.so
I made this small change to Makefile, but I'm not sure it will work with python < 3.10:
--- Makefile.orig 2022-12-09 12:10:37.827178273 +0300
+++ Makefile 2022-12-09 12:09:56.980536826 +0300
@@ -41,10 +41,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 := $(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)
+SO_PATH := build/lib.linux-$(shell uname -m)-cpython-$(PY_VER)
ifeq ($(PY_MV),2)
SO := $(SO_PATH)/dmidecodemod.so
else