pylibfdt: Allow switch to Python 3 via environment variable PYTHON
Python 2 is still the default but it can be changed by setting environment variable PYTHON before build/test. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
committed by
David Gibson
parent
11738cf01f
commit
8113c00b99
3
Makefile
3
Makefile
@@ -24,6 +24,7 @@ BISON = bison
|
|||||||
LEX = flex
|
LEX = flex
|
||||||
SWIG = swig
|
SWIG = swig
|
||||||
PKG_CONFIG ?= pkg-config
|
PKG_CONFIG ?= pkg-config
|
||||||
|
PYTHON ?= python2
|
||||||
|
|
||||||
INSTALL = /usr/bin/install
|
INSTALL = /usr/bin/install
|
||||||
INSTALL_PROGRAM = $(INSTALL)
|
INSTALL_PROGRAM = $(INSTALL)
|
||||||
@@ -147,7 +148,7 @@ all: $(BIN) libfdt
|
|||||||
# We need both Python and swig to build/install pylibfdt.
|
# We need both Python and swig to build/install pylibfdt.
|
||||||
# This builds the given make ${target} if those deps are found.
|
# This builds the given make ${target} if those deps are found.
|
||||||
check_python_deps = \
|
check_python_deps = \
|
||||||
if $(PKG_CONFIG) --cflags python2 >/dev/null 2>&1; then \
|
if $(PKG_CONFIG) --cflags $(PYTHON) >/dev/null 2>&1; then \
|
||||||
if which swig >/dev/null 2>&1; then \
|
if which swig >/dev/null 2>&1; then \
|
||||||
can_build=yes; \
|
can_build=yes; \
|
||||||
fi; \
|
fi; \
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ endif
|
|||||||
|
|
||||||
$(PYMODULE): $(PYLIBFDT_srcs) $(LIBFDT_archive) $(SETUP) $(VERSION_FILE)
|
$(PYMODULE): $(PYLIBFDT_srcs) $(LIBFDT_archive) $(SETUP) $(VERSION_FILE)
|
||||||
@$(VECHO) PYMOD $@
|
@$(VECHO) PYMOD $@
|
||||||
$(SETUP) $(SETUPFLAGS) build_ext --build-lib=../$(PYLIBFDT_objdir)
|
$(PYTHON) $(SETUP) $(SETUPFLAGS) build_ext --build-lib=../$(PYLIBFDT_objdir)
|
||||||
|
|
||||||
install_pylibfdt: $(PYMODULE)
|
install_pylibfdt: $(PYMODULE)
|
||||||
@$(VECHO) INSTALL-PYLIB
|
@$(VECHO) INSTALL-PYLIB
|
||||||
$(SETUP) $(SETUPFLAGS) install $(if $(SETUP_PREFIX),--prefix=$(SETUP_PREFIX))
|
$(PYTHON) $(SETUP) $(SETUPFLAGS) install $(if $(SETUP_PREFIX),--prefix=$(SETUP_PREFIX))
|
||||||
|
|
||||||
PYLIBFDT_cleanfiles = libfdt_wrap.c libfdt.py libfdt.pyc _libfdt.so
|
PYLIBFDT_cleanfiles = libfdt_wrap.c libfdt.py libfdt.pyc _libfdt.so
|
||||||
|
|||||||
@@ -81,18 +81,18 @@ tests_clean:
|
|||||||
rm -rf $(TESTS_CLEANDIRS)
|
rm -rf $(TESTS_CLEANDIRS)
|
||||||
|
|
||||||
check: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
|
check: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
|
||||||
cd $(TESTS_PREFIX); ./run_tests.sh
|
cd $(TESTS_PREFIX); PYTHON=$(PYTHON) ./run_tests.sh
|
||||||
|
|
||||||
ifeq ($(NO_VALGRIND),1)
|
ifeq ($(NO_VALGRIND),1)
|
||||||
checkm:
|
checkm:
|
||||||
@echo "make checkm requires valgrind, but NO_VALGRIND=1"
|
@echo "make checkm requires valgrind, but NO_VALGRIND=1"
|
||||||
else
|
else
|
||||||
checkm: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
|
checkm: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
|
||||||
cd $(TESTS_PREFIX); ./run_tests.sh -m
|
cd $(TESTS_PREFIX); PYTHON=$(PYTHON) ./run_tests.sh -m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
checkv: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
|
checkv: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
|
||||||
cd $(TESTS_PREFIX); ./run_tests.sh -v
|
cd $(TESTS_PREFIX); PYTHON=$(PYTHON) ./run_tests.sh -v
|
||||||
|
|
||||||
ifneq ($(DEPTARGETS),)
|
ifneq ($(DEPTARGETS),)
|
||||||
-include $(TESTS_DEPFILES)
|
-include $(TESTS_DEPFILES)
|
||||||
|
|||||||
@@ -933,7 +933,7 @@ fdtoverlay_tests() {
|
|||||||
pylibfdt_tests () {
|
pylibfdt_tests () {
|
||||||
run_dtc_test -I dts -O dtb -o test_props.dtb test_props.dts
|
run_dtc_test -I dts -O dtb -o test_props.dtb test_props.dts
|
||||||
TMP=/tmp/tests.stderr.$$
|
TMP=/tmp/tests.stderr.$$
|
||||||
python pylibfdt_tests.py -v 2> $TMP
|
$PYTHON pylibfdt_tests.py -v 2> $TMP
|
||||||
|
|
||||||
# Use the 'ok' message meaning the test passed, 'ERROR' meaning it failed
|
# Use the 'ok' message meaning the test passed, 'ERROR' meaning it failed
|
||||||
# and the summary line for total tests (e.g. 'Ran 17 tests in 0.002s').
|
# and the summary line for total tests (e.g. 'Ran 17 tests in 0.002s').
|
||||||
|
|||||||
Reference in New Issue
Block a user