nima / python-dmidecode

Python DMI-Decode
39 stars 27 forks source link

Build issue with python 3.10 #49

Open kyak opened 1 year ago

kyak commented 1 year ago

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
HuO50 commented 1 year ago

hello, kyak. Thanks for sending this message about build error, I test python3.10.8-3 version in fedora 36 release, but not happend this error. Can you provide more env info to find the bug?

kyak commented 1 year ago

I'm on an up to date Arch Linux, so latest everything.

I think it has something to do with cython. Do you have it installed?

kyak commented 1 year ago

Other people seem to have the same problem, see https://aur.archlinux.org/packages/python-dmidecode#comment-894512