diff options
author | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2015-04-27 15:29:18 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2015-04-27 15:29:18 +0200 |
commit | bb7939b061f468f977caba8e5fdaaff62096e7ac (patch) | |
tree | 6ca726a9ae8304a1a00e2047a5af1f1950399732 | |
parent | 0e3cdffac41250cddfe93388b1c9fc1547e77a67 (diff) | |
download | factory-boy-bb7939b061f468f977caba8e5fdaaff62096e7ac.tar factory-boy-bb7939b061f468f977caba8e5fdaaff62096e7ac.tar.gz |
Simplify dependencies installation for multi-version.
You may now use: ``make DJANGO_VERSION=1.7 test``.
Valid options:
* ``DJANGO_VERSION``
* ``MONGOENGINE_VERSION``
* ``ALCHEMY_VERSION``
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | Makefile | 31 | ||||
-rw-r--r-- | dev_requirements.txt | 2 | ||||
-rw-r--r-- | requirements.txt | 0 |
5 files changed, 31 insertions, 7 deletions
@@ -5,6 +5,7 @@ # Build-related files docs/_build/ +auto_dev_requirements*.txt .coverage .tox *.egg-info diff --git a/.travis.yml b/.travis.yml index a1d14f6..ed331d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,7 @@ script: - python setup.py test install: - - pip install Django - - pip install sqlalchemy --use-mirrors - - if ! python --version 2>&1 | grep -q -i pypy ; then pip install Pillow --use-mirrors; fi + - make install-deps notifications: email: false @@ -5,26 +5,51 @@ DOC_DIR=docs # Use current python binary instead of system default. COVERAGE = python $(shell which coverage) +# Dependencies +DJANGO_VERSION ?= 1.8 +NEXT_DJANGO_VERSION = $(shell python -c "v='$(DJANGO_VERSION)'; parts=v.split('.'); parts[-1]=str(int(parts[-1])+1); print('.'.join(parts))") + +ALCHEMY_VERSION ?= 1.0 +NEXT_ALCHEMY_VERSION = $(shell python -c "v='$(ALCHEMY_VERSION)'; parts=v.split('.'); parts[-1]=str(int(parts[-1])+1); print('.'.join(parts))") + +MONGOENGINE_VERSION ?= 0.9 +NEXT_MONGOENGINE_VERSION = $(shell python -c "v='$(MONGOENGINE_VERSION)'; parts=v.split('.'); parts[-1]=str(int(parts[-1])+1); print('.'.join(parts))") + +REQ_FILE = auto_dev_requirements_django$(DJANGO_VERSION)_alchemy$(ALCHEMY_VERSION)_mongoengine$(MONGOENGINE_VERSION).txt + all: default default: +install-deps: $(REQ_FILE) + pip install --upgrade pip setuptools + pip install --upgrade -r $< + pip freeze + +$(REQ_FILE): dev_requirements.txt requirements.txt + grep --no-filename "^[^#-]" $^ | egrep -v "^(Django|SQLAlchemy|mongoengine)" > $@ + echo "Django>=$(DJANGO_VERSION),<$(NEXT_DJANGO_VERSION)" >> $@ + echo "SQLAlchemy>=$(ALCHEMY_VERSION),<$(NEXT_ALCHEMY_VERSION)" >> $@ + echo "mongoengine>=$(MONGOENGINE_VERSION),<$(NEXT_MONGOENGINE_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 pylint: pylint --rcfile=.pylintrc --report=no $(PACKAGE)/ -coverage: +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" @@ -34,4 +59,4 @@ doc: $(MAKE) -C $(DOC_DIR) html -.PHONY: all default clean coverage doc pylint test +.PHONY: all default clean coverage doc install-deps pylint test diff --git a/dev_requirements.txt b/dev_requirements.txt index a8dd896..7c29185 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,7 +1,7 @@ coverage Django Pillow -sqlalchemy +SQLAlchemy mongoengine mock wheel diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/requirements.txt |