Subjectively clean up Makefile
I think the following Makefile might be a little more maintainable, grokkable, and robust.
This commit is contained in:
parent
49806375b1
commit
536d3cab85
60
Makefile
60
Makefile
@ -1,39 +1,39 @@
|
|||||||
SYSTEMPYTHON = `which python2 python | head -n 1`
|
SYSTEMPYTHON = `which python2 python | head -n 1`
|
||||||
VIRTUALENV = virtualenv --python=$(SYSTEMPYTHON)
|
VIRTUALENV = virtualenv --python=$(SYSTEMPYTHON)
|
||||||
PYTHON = local/bin/python
|
ENV = ./local
|
||||||
NOSE = local/bin/nosetests -s
|
TOOLS := $(addprefix $(ENV)/bin/,flake8 nosetests)
|
||||||
FLAKE8 = local/bin/flake8
|
|
||||||
PIP = local/bin/pip
|
|
||||||
PIP_CACHE = /tmp/pip-cache.${USER}
|
|
||||||
BUILD_TMP = /tmp/syncstorage-build.${USER}
|
|
||||||
PYPI = https://pypi.python.org/simple
|
|
||||||
INSTALL = $(PIP) install -U -i $(PYPI)
|
|
||||||
|
|
||||||
.PHONY: all build test serve clean
|
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
all: build test
|
all: build test
|
||||||
|
|
||||||
build:
|
.PHONY: build
|
||||||
$(VIRTUALENV) --no-site-packages --distribute ./local
|
build: | $(ENV)
|
||||||
$(INSTALL) --upgrade Distribute
|
$(ENV):
|
||||||
$(INSTALL) pip
|
$(VIRTUALENV) --no-site-packages $(ENV)
|
||||||
$(INSTALL) nose
|
$(ENV)/bin/pip install -r requirements.txt
|
||||||
$(INSTALL) flake8
|
$(ENV)/bin/python ./setup.py develop
|
||||||
$(INSTALL) -r requirements.txt
|
|
||||||
$(PYTHON) ./setup.py develop
|
|
||||||
|
|
||||||
test:
|
.PHONY: test
|
||||||
# Basic syntax and sanity checks.
|
test: | $(TOOLS)
|
||||||
$(FLAKE8) ./syncserver
|
$(ENV)/bin/flake8 ./syncserver
|
||||||
# Testcases from syncstorage app
|
$(ENV)/bin/nosetests -s syncstorage.tests
|
||||||
$(NOSE) syncstorage.tests
|
# Tokenserver tests currently broken due to incorrect file paths
|
||||||
# Testcases from tokenserver app; broken due to incorrect file paths
|
# $(ENV)/bin/nosetests -s tokenserver.tests
|
||||||
#$(NOSE) tokenserver.tests
|
|
||||||
# Live tests against a running server.
|
|
||||||
./local/bin/pserve syncserver/tests.ini & SERVER_PID=$$! ; sleep 2 ; ./local/bin/python -m syncstorage.tests.functional.test_storage --use-token-server http://localhost:5000/token/1.0/sync/1.5 ; kill $$SERVER_PID
|
|
||||||
|
|
||||||
serve:
|
# Test against a running server
|
||||||
./local/bin/pserve ./syncserver.ini
|
$(ENV)/bin/pserve syncserver/tests.ini & SERVER_PID=$$!; \
|
||||||
|
sleep 2; \
|
||||||
|
$(ENV)/bin/python -m syncstorage.tests.functional.test_storage \
|
||||||
|
--use-token-server http://localhost:5000/token/1.0/sync/1.5; \
|
||||||
|
kill $$SERVER_PID
|
||||||
|
|
||||||
|
$(TOOLS): | $(ENV)
|
||||||
|
$(ENV)/bin/pip install nose flake8
|
||||||
|
|
||||||
|
.PHONY: serve
|
||||||
|
serve: | $(ENV)
|
||||||
|
$(ENV)/bin/pserve ./syncserver.ini
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf ./local
|
rm -rf $(ENV)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user