diff --git a/Makefile b/Makefile
index a1ad3a5..c923dbc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,10 @@
#!/usr/bin/make
+TOX_VER = $(shell tox --version 2>/dev/null || echo "0.0")
+TOX_VER_MAJOR := $(shell echo $(TOX_VER) | cut -f1 -d.)
+TOX_VER_MINOR := $(shell echo $(TOX_VER) | cut -f2 -d.)
+TOX_GT_1_8 := $(shell [ $(TOX_VER_MAJOR) -gt 1 -o \( $(TOX_VER_MAJOR) -eq 1 -a $(TOX_VER_MINOR) -ge 8 \) ] && echo true)
+
all: lint unit_test
@@ -7,18 +12,22 @@ all: lint unit_test
clean:
@rm -rf .tox
-.PHONY: apt_prereqs
-apt_prereqs:
- @# Need tox, but don't install the apt version unless we have to (don't want to conflict with pip)
- @which tox >/dev/null || (sudo apt-get install -y python-pip && sudo pip install tox)
+.PHONY: tox_prereq
+tox_prereq:
+ifneq ($(TOX_GT_1_8),true)
+ @echo "Pip installing tox"
+ virtualenv .venv --system-site-packages
+ .venv/bin/pip install -Ur requirements.txt
+ .venv/bin/pip install --upgrade tox
+endif
.PHONY: lint
-lint: apt_prereqs
- @tox --notest
- @PATH=.tox/py34/bin:.tox/py35/bin flake8 $(wildcard hooks reactive lib unit_tests tests)
+lint: tox_prereq
+ @PATH=.venv/bin:$PATH tox --notest
+ @PATH=.tox/py34/bin:.tox/py35/bin:.venv/bin flake8 $(wildcard hooks reactive lib unit_tests tests)
@charm proof
.PHONY: unit_test
-unit_test: apt_prereqs
+unit_test: tox_prereq
@echo Starting tests...
- tox
+ @PATH=.venv/bin:$PATH tox