diff options
Diffstat (limited to 'utils/Makefile')
-rw-r--r-- | utils/Makefile | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/utils/Makefile b/utils/Makefile index 79c27626a..038c31fcf 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -22,9 +22,21 @@ NAME := oo-install +VENV := $(NAME)env TESTPACKAGE := oo-install SHORTNAME := ooinstall +# This doesn't evaluate until it's called. The -D argument is the +# directory of the target file ($@), kinda like `dirname`. +ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $< +MANPAGES := docs/man/man1/atomic-openshift-installer.1 +# slipped into the manpage template before a2x processing +VERSION := 1.4 + +# YAMLFILES: Skipping all '/files/' folders due to conflicting yaml file definitions +YAMLFILES = $(shell find ../ -name $(VENV) -prune -o -name .tox -prune -o \( -name '*.yml' -o -name '*.yaml' \) ! -path "*/files/*" -print 2>&1) +PYFILES = $(shell find ../ -name $(VENV) -prune -o -name ooinstall.egg-info -prune -o -name test -prune -o -name .tox -prune -o -name "*.py" -print) + sdist: clean python setup.py sdist rm -fR $(SHORTNAME).egg-info @@ -33,51 +45,66 @@ clean: @find . -type f -regex ".*\.py[co]$$" -delete @find . -type f \( -name "*~" -or -name "#*" \) -delete @rm -fR build dist rpm-build MANIFEST htmlcov .coverage cover ooinstall.egg-info oo-install - @rm -fR $(NAME)env + @rm -fR $(VENV) + @rm -fR .tox + +# To force a rebuild of the docs run 'touch' on any *.in file under +# docs/man/man1/ +docs: $(MANPAGES) + +# Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more +# recently than %.1.asciidoc. +%.1.asciidoc: %.1.asciidoc.in + sed "s/%VERSION%/$(VERSION)/" $< > $@ + +# Regenerate %.1 if %.1.asciidoc or VERSION has been modified more +# recently than %.1. (Implicitly runs the %.1.asciidoc recipe) +%.1: %.1.asciidoc + $(ASCII2MAN) viewcover: xdg-open cover/index.html -virtualenv: +# Conditional virtualenv building strategy taken from this great post +# by Marcel Hellkamp: +# http://blog.bottlepy.org/2012/07/16/virtualenv-and-makefiles.html +$(VENV): $(VENV)/bin/activate +$(VENV)/bin/activate: test-requirements.txt @echo "#############################################" @echo "# Creating a virtualenv" @echo "#############################################" - virtualenv $(NAME)env - . $(NAME)env/bin/activate && pip install setuptools==17.1.1 - . $(NAME)env/bin/activate && pip install -r test-requirements.txt + test -d $(VENV) || virtualenv $(VENV) + . $(VENV)/bin/activate && pip install setuptools==17.1.1 + . $(VENV)/bin/activate && pip install -r test-requirements.txt + touch $(VENV)/bin/activate # If there are any special things to install do it here -# . $(NAME)env/bin/activate && INSTALL STUFF +# . $(VENV)/bin/activate && INSTALL STUFF -ci-unittests: +ci-unittests: $(VENV) @echo "#############################################" @echo "# Running Unit Tests in virtualenv" @echo "#############################################" - . $(NAME)env/bin/activate && nosetests -v --with-coverage --cover-html --cover-min-percentage=70 --cover-package=$(SHORTNAME) test/ + . $(VENV)/bin/activate && detox -e py27-unit,py35-unit @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'" -ci-pylint: +ci-pylint: $(VENV) @echo "#############################################" @echo "# Running PyLint Tests in virtualenv" @echo "#############################################" - . $(NAME)env/bin/activate && python -m pylint --rcfile ../git/.pylintrc src/ooinstall/cli_installer.py src/ooinstall/oo_config.py src/ooinstall/openshift_ansible.py src/ooinstall/variants.py + . $(VENV)/bin/activate && detox -e py27-pylint,py35-pylint -ci-list-deps: +ci-flake8: $(VENV) @echo "#############################################" - @echo "# Listing all pip deps" + @echo "# Running Flake8 Compliance Tests in virtualenv" @echo "#############################################" - . $(NAME)env/bin/activate && pip freeze + . $(VENV)/bin/activate && detox -e py27-flake8,py35-flake8 -ci-pyflakes: - @echo "#################################################" - @echo "# Running Pyflakes Compliance Tests in virtualenv" - @echo "#################################################" - . $(NAME)env/bin/activate && pyflakes src/ooinstall/*.py +ci-tox: $(VENV) + . $(VENV)/bin/activate && detox -ci-pep8: - @echo "#############################################" - @echo "# Running PEP8 Compliance Tests in virtualenv" - @echo "#############################################" - . $(NAME)env/bin/activate && pep8 --ignore=E501,E121,E124 src/$(SHORTNAME)/ - -ci: clean virtualenv ci-list-deps ci-pep8 ci-pylint ci-pyflakes ci-unittests - : +ci: ci-tox + @echo + @echo "##################################################################################" + @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'" + @echo "To clean your test environment run 'make clean'" + @echo "Other targets you may run with 'make': 'ci-pylint', 'ci-tox', 'ci-unittests', 'ci-flake8'" |