Skip to content

Commit 6b370a4

Browse files
committed
Don't be too complicated.
There is actually no reason to use distutils.sysconfig at all, plain sysconfig works even on 2.7.
1 parent 19f19ac commit 6b370a4

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ 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 '.')
4546
PY_MV := $(shell echo $(PY_VER) | cut -b 1)
4647
PY := python$(PY_VER)
47-
SO_PATH := build/lib.linux-$(shell uname -m)-$(PY_VER)
48+
SO_PATH := build/lib.linux-$(shell uname -m)-cpython-$(PY_VER_DL)
4849
ifeq ($(PY_MV),2)
4950
SO := $(SO_PATH)/dmidecodemod.so
5051
else

src/setup_common.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@
3030
if sys.version_info[0] < 3:
3131
import commands as subprocess
3232
from os import path as os_path
33-
try:
34-
from distutils.sysconfig import get_python_lib, get_config_var
35-
__python_lib = get_python_lib(1)
36-
except ImportError:
37-
from sysconfig import get_config_var, get_path
38-
__python_lib = get_path('platlib')
33+
from sysconfig import get_config_var, get_path
3934

4035
# libxml2 - C flags
4136
def libxml2_include(incdir):
@@ -55,7 +50,7 @@ def libxml2_include(incdir):
5550

5651
# libxml2 - library flags
5752
def libxml2_lib(libdir, libs):
58-
libdir.append(__python_lib)
53+
libdir.append(get_path('platlib'))
5954
if os_path.exists("/etc/debian_version"): #. XXX: Debian Workaround...
6055
libdir.append("/usr/lib/pymodules/python%d.%d"%sys.version_info[0:2])
6156

0 commit comments

Comments
 (0)