-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (27 loc) · 1.01 KB
/
Makefile
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
WORK_DIR = $(shell pwd)
VIRTUALENV = $(shell if hash virtualenv2 2>/dev/null; then \
echo "virtualenv2"; \
else \
echo "virtualenv"; \
fi)
PYTHON_VERSION = $(lastword $(sort $(wildcard $(addsuffix /python2.?,$(subst :, ,$(PATH))))))
# If the first argument is "run"...
ifeq (run,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
.PHONY: all clean deps run
all: clean deps
clean:
rm -rf venv
rm -f *.pyc
deps:
@if [ -z "$(PYTHON_VERSION)" ]; then echo "error: couldn't find a valid version of python installed"; false; fi
@if ! hash $(VIRTUALENV) 2>/dev/null; then echo "error: couldn't find a valid version of virtualenv installed"; false; fi
if [ ! -d venv ]; then $(VIRTUALENV) --python=$(PYTHON_VERSION) venv; fi
./venv/bin/pip install --upgrade pip
./venv/bin/pip install --upgrade -r requirements.txt
run:
./venv/bin/python announce.py $(RUN_ARGS)