summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polyconseil.fr>2015-07-02 16:20:25 +0200
committerRaphaël Barrois <raphael.barrois@polyconseil.fr>2015-07-02 16:35:57 +0200
commitee65fd925dc5bf7ff388e997b7ffa5726c00898e (patch)
tree13a556df6fadf404b47b6cb5347ff0e7799aa780 /Makefile
parent2174bdcae6e46f5f68f5b8ea984a695db9f41bcf (diff)
downloadsemantic-version-ee65fd925dc5bf7ff388e997b7ffa5726c00898e.tar.gz
Switch to django-version-dependant install scheme.
Also update travis to use it.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 36 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 22e50d8..c700042 100644
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,53 @@
-all: default
+PACKAGE=semantic_version
+TESTS_DIR=tests
+DOC_DIR=docs
+
+# Use current python binary instead of system default.
+COVERAGE = python $(shell which coverage)
+# Dependencies
+DJANGO_VERSION ?= 1.8
+PYTHON_VERSION := $(shell python --version)
+NEXT_DJANGO_VERSION=$(shell python -c "v='$(DJANGO_VERSION)'; parts=v.split('.'); parts[-1]=str(int(parts[-1])+1); print('.'.join(parts))")
-PACKAGE_DIR = src/semantic_version
+
+all: default
default:
+install-deps: auto_dev_requirements_django$(DJANGO_VERSION).txt
+ pip install --upgrade pip setuptools
+ pip install --upgrade -r $<
+ pip freeze
+
+auto_dev_requirements_%.txt: dev_requirements_%.txt dev_requirements.txt requirements.txt
+ grep --no-filename "^[^-]" $^ | grep -v "^Django" > $@
+ echo "Django>=$(DJANGO_VERSION),<$(NEXT_DJANGO_VERSION)" >> $@
+
clean:
find . -type f -name '*.pyc' -delete
+ find . -type f -path '*/__pycache__/*' -delete
+ find . -type d -empty -delete
+ @rm -f auto_dev_requirements_*
+ @rm -rf tmp_test/
-test:
+test: install-deps
python -W default setup.py test
-coverage:
- coverage erase
- coverage run "--include=$(PACKAGE_DIR)/*.py,tests/*.py" --branch setup.py test
- coverage report "--include=$(PACKAGE_DIR)/*.py,tests/*.py"
- coverage html "--include=$(PACKAGE_DIR)/*.py,tests/*.py"
+pylint:
+ pylint --rcfile=.pylintrc --report=no $(PACKAGE)/
-doc:
- $(MAKE) -C docs html
+coverage: install-deps
+ $(COVERAGE) erase
+ $(COVERAGE) run "--include=$(PACKAGE)/*.py,$(TESTS_DIR)/*.py" --branch setup.py test
+ $(COVERAGE) report "--include=$(PACKAGE)/*.py,$(TESTS_DIR)/*.py"
+ $(COVERAGE) html "--include=$(PACKAGE)/*.py,$(TESTS_DIR)/*.py"
+doc:
+ $(MAKE) -C $(DOC_DIR) html
-.PHONY: all default clean coverage doc test
+.PHONY: all default clean coverage doc install-deps pylint test