Skip to content

Commit a796f81

Browse files
committed
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.
1 parent 6b370a4 commit a796f81

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ PY_BIN := python3
4242
VERSION := $(shell cd src;$(PY_BIN) -c "from setup_common import *; print(get_version());")
4343
PACKAGE := python-dmidecode
4444
PY_VER := $(shell $(PY_BIN) -c 'import sys; print("%d.%d"%sys.version_info[0:2])')
45-
PY_VER_DL := $(shell echo $(PY_VER) | tr -d '.')
4645
PY_MV := $(shell echo $(PY_VER) | cut -b 1)
4746
PY := python$(PY_VER)
48-
SO_PATH := build/lib.linux-$(shell uname -m)-cpython-$(PY_VER_DL)
4947
ifeq ($(PY_MV),2)
50-
SO := $(SO_PATH)/dmidecodemod.so
48+
SOLIB := dmidecodemod.so
5149
else
5250
SOABI := $(shell $(PY_BIN) -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))')
53-
SO := $(SO_PATH)/dmidecodemod.$(SOABI).so
51+
SOLIB := dmidecodemod.$(SOABI).so
5452
endif
5553
SHELL := /bin/bash
5654

@@ -60,10 +58,10 @@ SHELL := /bin/bash
6058
all : build dmidump
6159

6260
build: $(PY)-dmidecodemod.so
63-
$(PY)-dmidecodemod.so: $(SO)
64-
cp $< $@
65-
$(SO):
61+
62+
$(PY)-dmidecodemod.so:
6663
$(PY) src/setup.py build
64+
cp $$(find build -name $(SOLIB)) $@
6765

6866
dmidump : src/util.o src/efi.o src/dmilog.o
6967
$(CC) -o $@ src/dmidump.c $^ -g -Wall -D_DMIDUMP_MAIN_

0 commit comments

Comments
 (0)