Ubuntu Pastebin

Paste from Cory at Mon, 2 May 2016 22:21:08 +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
diff --git a/Makefile b/Makefile
index a1ad3a5..fdae08b 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,13 +12,15 @@ 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_prereqs
+tox_prereqs:
+ifneq ($(TOX_GT_1_8),true)
+        @echo "Pip installing tox"
+        sudo apt-get install -y python-pip && sudo pip install -U 'tox>=1.8'
+endif
 
 .PHONY: lint
-lint: apt_prereqs
+lint: tox_prereqs
        @tox --notest
        @PATH=.tox/py34/bin:.tox/py35/bin flake8 $(wildcard hooks reactive lib unit_tests tests)
        @charm proof
Download as text