Commits

Andriy Kornatskyy committed 172adf3

Minor refactoring in Makefile targets.

  • Participants
  • Parent commits 79441eb

Comments (0)

Files changed (1)

-.SILENT: clean env po doctest-cover qa test doc release upload
-.PHONY: clean env po doctest-cover qa test doc release upload
+.SILENT: clean env nose-cover test-cover qa test doc release upload
+.PHONY: clean env nose-cover test-cover qa test doc release upload
 
 VERSION=2.7
 PYPI=http://pypi.python.org/simple
 EASY_INSTALL=env/bin/easy_install-$(VERSION)
 PYTEST=env/bin/py.test-$(VERSION)
 NOSE=env/bin/nosetests-$(VERSION)
-SPHINX=/usr/bin/python /usr/bin/sphinx-build
 
-all: clean po doctest-cover test release
+all: clean nose-cover test release
 
 debian:
-	apt-get -yq update
-	apt-get -yq dist-upgrade
-	# How to Compile Python from Source
-	# http://mindref.blogspot.com/2011/09/compile-python-from-source.html
-	apt-get -yq install libbz2-dev build-essential python \
-		python-dev python-setuptools python-virtualenv \
-		python-shpinx mercurial
+	apt-get -y update ; \
+	apt-get -y dist-upgrade ; \
+	apt-get -y --no-install-recommends install libbz2-dev build-essential \
+		python python-dev python-setuptools python-virtualenv
 
 env:
 	PYTHON_EXE=/usr/local/bin/python$(VERSION) ; \
 			PYTHON_EXE=/usr/bin/python$(VERSION) ; \
 		fi ; \
 	fi ; \
-	VIRTUALENV_USE_SETUPTOOLS=1; \
-	export VIRTUALENV_USE_SETUPTOOLS; \
+	VIRTUALENV_USE_SETUPTOOLS=1 ; \
+	export VIRTUALENV_USE_SETUPTOOLS ; \
 	virtualenv --python=$$PYTHON_EXE \
-		--no-site-packages env
+		--no-site-packages env ; \
 	if [ "$$(echo $(VERSION) | sed 's/\.//')" -ge 30 ]; then \
-		echo -n 'Upgrading distribute...'; \
+		/bin/echo -n 'Upgrading distribute...' ; \
 		$(EASY_INSTALL) -i $(PYPI) -U -O2 distribute \
-			> /dev/null 2>/dev/null; \
-		echo 'done.'; \
-	fi
+			> /dev/null 2>/dev/null ; \
+		/bin/echo 'done.' ; \
+	fi ; \
 	$(EASY_INSTALL) -i $(PYPI) -O2 coverage nose pytest \
-		pytest-pep8 pytest-cov mako tenjin jinja2 wheezy.template
-	# The following packages available for python < 3.0
-	#if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
-	#	$(EASY_INSTALL) sphinx; \
-	#fi
+		pytest-pep8 pytest-cov mako tenjin jinja2 wheezy.template ; \
 	$(PYTHON) setup.py develop -i $(PYPI)
 
 clean:
 	find src/ -type d -name __pycache__ | xargs rm -rf
 	find src/ -name '*.py[co]' -delete
 	find src/ -name '*.so' -delete
-	rm -rf dist/ build/ MANIFEST src/*.egg-info .cache .coverage
+	rm -rf dist/ build/ doc/_build/ MANIFEST src/*.egg-info .cache .coverage
 
 release:
 	$(PYTHON) setup.py -q bdist_egg
 
 upload:
-	REV=$$(hg head --template '{rev}');\
+	REV=$$(hg head --template '{rev}') ; \
 	sed -i "s/'0.1'/'0.1.$$REV'/" src/wheezy/html/__init__.py ; \
 	if [ "$$(echo $(VERSION) | sed 's/\.//')" -eq 27 ]; then \
 		$(PYTHON) setup.py -q egg_info --tag-build .$$REV \
-			sdist register upload; \
-		$(EASY_INSTALL) -i $(PYPI) sphinx; \
+			sdist register upload ; \
+		$(EASY_INSTALL) -i $(PYPI) sphinx ; \
 		$(PYTHON) env/bin/sphinx-build -D release=0.1.$$REV \
-			-a -b html doc/ doc/_build/;\
-		python setup.py upload_docs; \
+			-a -b html doc/ doc/_build/ ; \
+		python setup.py upload_docs ; \
 	fi
 	# Do not uploads eggs when there is C extensions.
 	# Prefer build on client.
 	#	upload;
 
 qa:
-	if [ "$$(echo $(VERSION) | sed 's/\.//')" -eq 27 ]; then \
-		flake8 --max-complexity 10 doc src setup.py && \
-		pep8 doc src setup.py ; \
-	fi
+	env/bin/flake8 --max-complexity 10 doc src setup.py && \
+	env/bin/pep8 doc src setup.py
 
 test:
 	$(PYTHON) setup.py -q build ; \
 	$(PYTHON) setup.py -q develop ; \
-	$(PYTEST) -q -x --pep8 --doctest-modules \
-		src/wheezy/html
+	$(PYTEST) -q -x --pep8 --doctest-modules src/wheezy/html
 
-doctest-cover:
+nose-cover:
 	$(NOSE) --stop --with-doctest --detailed-errors \
 		--with-coverage --cover-package=wheezy.html
 
 test-cover:
-	$(PYTEST) -q --cov wheezy.html \
-		--cov-report term-missing \
-		src/wheezy/html
+	$(PYTEST) -q --cov-report term-missing \
+		--cov wheezy.html src/wheezy/html
 
 doc:
-	$(SPHINX) -a -b html doc/ doc/_build/
+	$(PYTHON) env/bin/sphinx-build -a -b html doc/ doc/_build/
 
 test-demos:
 	$(PYTEST) -q -x --pep8 demos/