diff options
author | Slavek Kabrda <bkabrda@redhat.com> | 2015-01-21 12:57:35 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2015-02-03 21:16:25 +0100 |
commit | 5cc3d02060f67317049b6e0549c87a407e030e61 (patch) | |
tree | 15174b46cabd9ea08a1c9c35ebb831018577f00f /Makefile | |
parent | 9fa1352cd540aa69dd8b59e56de9b8020563e545 (diff) | |
download | python-dmidecode-5cc3d02060f67317049b6e0549c87a407e030e61.tar.gz python-dmidecode-5cc3d02060f67317049b6e0549c87a407e030e61.tar.xz python-dmidecode-5cc3d02060f67317049b6e0549c87a407e030e61.zip |
Port to Python 3 while maintaining compatibility with Python >= 2.6
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -38,11 +38,19 @@ #. $AutoHeaderSerial::20100225 $ #. ******* AUTOHEADER END v1.2 ******* -VERSION := $(shell cd src;python -c "from setup_common import *; print get_version();") +PY_BIN := python2 +VERSION := $(shell cd src;$(PY_BIN) -c "from setup_common import *; print(get_version());") PACKAGE := python-dmidecode -PY_VER := $(shell python -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 := build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecodemod.so +SO_PATH := build/lib.linux-$(shell uname -m)-$(PY_VER) +ifeq ($(PY_MV),2) + SO := $(SO_PATH)/dmidecodemod.so +else + SOABI := $(shell $(PY_BIN) -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))') + SO := $(SO_PATH)/dmidecodemod.$(SOABI).so +endif SHELL := /bin/bash ############################################################################### @@ -71,6 +79,7 @@ clean: -rm -rf build -rm -rf rpm -rm -rf src/setup_common.py[oc] + -rm -rf __pycache__ src/__pycache__ -rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.gz $(MAKE) -C unit-tests clean |