Ubuntu Pastebin

Paste from kwm at Mon, 2 May 2016 21:19:09 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
Download as text