Make tox work with non-venv interpreters

Previously, as soon as an interpreter that wasn't the one having been
used for `env` was used by tox, we would get errors because our C
modules wouldn't be built for this interpreter.

The makefile has been changed to make `make modules` interpreter-aware,
thus fixing this problem.
This commit is contained in:
Virgil Dupras 2017-09-19 13:14:11 -04:00
parent 8cd0ef4c2b
commit a6b1e6e9ab
2 changed files with 21 additions and 17 deletions

View File

@ -1,4 +1,5 @@
PYTHON ?= python3
PYTHON_VERSION_MINOR := $(shell ${PYTHON} -c "import sys; print(sys.version_info.minor)")
PYRCC5 ?= pyrcc5
REQ_MINOR_VERSION = 4
PREFIX ?= /usr/local
@ -10,11 +11,11 @@ PREFIX ?= /usr/local
ifeq ($(shell uname -o), Msys)
BIN = Scripts
SO = pyd
SO = *.pyd
VENV_OPTIONS =
else
BIN = bin
SO = so
SO = cpython-3$(PYTHON_VERSION_MINOR)m*.so
VENV_OPTIONS = --system-site-packages
endif
@ -53,11 +54,9 @@ pyc:
${PYTHON} -m compileall ${packages}
reqs :
@ret=`${PYTHON} -c "import sys; print(int(sys.version_info[:2] >= (3, ${REQ_MINOR_VERSION})))"`; \
if [ $${ret} -ne 1 ]; then \
echo "Python 3.${REQ_MINOR_VERSION}+ required. Aborting."; \
exit 1; \
fi
ifneq ($(shell test $(PYTHON_VERSION_MINOR) -gt $(REQ_MINOR_VERSION); echo $$?),0)
$(error "Python 3.${REQ_MINOR_VERSION}+ required. Aborting.")
endif
ifndef NO_VENV
@${PYTHON} -m venv -h > /dev/null || \
echo "Creation of our virtualenv failed. If you're on Ubuntu, you probably need python3-venv."
@ -91,19 +90,19 @@ i18n: $(mofiles)
%.mo : %.po
msgfmt -o $@ $<
core/pe/_block.*.$(SO) : core/pe/modules/block.c core/pe/modules/common.c | env
$(VENV_PYTHON) hscommon/build_ext.py $^ _block
mv _block.*.$(SO) core/pe
core/pe/_block.$(SO) : core/pe/modules/block.c core/pe/modules/common.c
$(PYTHON) hscommon/build_ext.py $^ _block
mv _block.$(SO) core/pe
core/pe/_cache.*.$(SO) : core/pe/modules/cache.c core/pe/modules/common.c | env
$(VENV_PYTHON) hscommon/build_ext.py $^ _cache
mv _cache.*.$(SO) core/pe
core/pe/_cache.$(SO) : core/pe/modules/cache.c core/pe/modules/common.c
$(PYTHON) hscommon/build_ext.py $^ _cache
mv _cache.$(SO) core/pe
qt/pe/_block_qt.*.$(SO) : qt/pe/modules/block.c | env
$(VENV_PYTHON) hscommon/build_ext.py $^ _block_qt
mv _block_qt.*.$(SO) qt/pe
qt/pe/_block_qt.$(SO) : qt/pe/modules/block.c
$(PYTHON) hscommon/build_ext.py $^ _block_qt
mv _block_qt.$(SO) qt/pe
modules : core/pe/_block.*.$(SO) core/pe/_cache.*.$(SO) qt/pe/_block_qt.*.$(SO)
modules : core/pe/_block.$(SO) core/pe/_cache.$(SO) qt/pe/_block_qt.$(SO)
mergepot :
$(VENV_PYTHON) build.py --mergepot

View File

@ -4,7 +4,12 @@ skipsdist = True
skip_missing_interpreters = True
[testenv]
whitelist_externals =
make
setenv =
PYTHON="{envpython}"
commands =
make modules
flake8
py.test core hscommon
deps =