Source

wheezy.web / Makefile

Full commit
Andriy Kornatsky… e9f5263 

Andriy Kornatsky… 1e0e64a 
Andriy Kornatsky… 41f38d1 
Andriy Kornatsky… 1e0e64a 
Andriy Kornatsky… a139000 
Andriy Kornatsky… 1e0e64a 




Andriy Kornatsky… 533e936 
Andriy Kornatsky… 1e0e64a 
Andriy Kornatsky… b7ce235 
Andriy Kornatsky… 1e0e64a 

Andriy Kornatsky… ba94f4a 

Andriy Kornatsky… 1e0e64a 

Andriy Kornatsky… ba94f4a 
Andriy Kornatsky… 1e0e64a 







Andriy Kornatsky… ba94f4a 

Andriy Kornatsky… 1e0e64a 

Andriy Kornatsky… 5d664f6 





Andriy Kornatsky… 1e0e64a 
Andriy Kornatsky… a765cb3 
Andriy Kornatsky… eccb5f3 




Andriy Kornatsky… 1e0e64a 


Andriy Kornatsky… ea502af 

Andriy Kornatsky… 6ed704c 
Andriy Kornatsky… 1e0e64a 



Andriy Kornatsky… a139000 




Andriy Kornatsky… d9a9e6b 


Andriy Kornatsky… a139000 






Andriy Kornatsky… e9f5263 





Andriy Kornatsky… 1e0e64a 








Andriy Kornatsky… 1ffc0d9 


Andriy Kornatsky… 1e0e64a 





Andriy Kornatsky… 192812f 
Andriy Kornatsky… 2324123 
Andriy Kornatsky… a5d621c 
Andriy Kornatsky… 2324123 

Andriy Kornatsky… f0c0255 
Andriy Kornatsky… 05d1caf 
.SILENT: clean env doctest-cover qa test doc release upload
.PHONY: clean env doctest-cover qa test doc release upload

VERSION=2.7
PYPI=http://pypi.python.org/simple
DIST_DIR=dist

PYTHON=env/bin/python$(VERSION)
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 doctest-cover test test-demos release

debian:
	apt-get -y update
	apt-get -y dist-upgrade
	# How to Compile Python from Source
	# http://mindref.blogspot.com/2011/09/compile-python-from-source.html
	apt-get -y install libbz2-dev build-essential python \
		python-dev python-setuptools python-virtualenv \
		python-sphinx mercurial

env:
	PYTHON_EXE=/usr/local/bin/python$(VERSION); \
	if [ ! -x $$PYTHON_EXE ]; then \
		PYTHON_EXE=/usr/bin/python$(VERSION); \
	fi;\
    VIRTUALENV_USE_SETUPTOOLS=1; \
    export VIRTUALENV_USE_SETUPTOOLS; \
	virtualenv --python=$$PYTHON_EXE \
		--no-site-packages env
	if [ "$$(echo $(VERSION) | sed 's/\.//')" -ge 30 ]; then \
		echo -n 'Upgrading distribute...'; \
		$(EASY_INSTALL) -i $(PYPI) -U -O2 distribute \
			> /dev/null 2>/dev/null; \
		echo 'done.'; \
	fi
	$(EASY_INSTALL) -i $(PYPI) -O2 coverage nose pytest \
		pytest-pep8 pytest-cov mock lxml mako tenjin jinja2 \
		wheezy.template
	# The following packages available for python == 2.4
	if [ "$$(echo $(VERSION) | sed 's/\.//')" -eq 24 ]; then \
		$(EASY_INSTALL) -i $(PYPI) -O2 wsgiref; \
	fi
	$(PYTHON) setup.py develop -i $(PYPI)

clean:
	find src/ demos/ -type d -name __pycache__ | xargs rm -rf
	find src/ demos/ -name '*.py[co]' -delete
	rm -rf dist/ build/ MANIFEST src/*.egg-info .cache .coverage

release:
	$(PYTHON) setup.py -q bdist_egg

upload:
	REV=$$(hg head --template '{rev}');\
	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; \
		$(PYTHON) env/bin/sphinx-build -D release=0.1.$$REV \
			-a -b html doc/ doc/_build/;\
		python setup.py upload_docs; \
	fi; \
	$(PYTHON) setup.py -q egg_info --tag-build .$$REV \
		bdist_egg --dist-dir=$(DIST_DIR) \
		rotate --match=$(VERSION).egg --keep=1 --dist-dir=$(DIST_DIR) \
		upload;

qa:
	if [ "$$(echo $(VERSION) | sed 's/\.//')" -eq 27 ]; then \
		flake8 --max-complexity 10 demos doc src setup.py && \
		pep8 demos doc src setup.py ; \
	fi

test:
	$(PYTEST) -q -x --pep8 --doctest-modules \
		src/wheezy/web

doctest-cover:
	$(NOSE) --stop --with-doctest --detailed-errors \
		--with-coverage --cover-package=wheezy.web

test-cover:
	$(PYTEST) -q --cov wheezy.web --cov wheezy.web.handlers \
		--cov wheezy.web.middleware --cov-report term-missing \
		src/wheezy/web/handlers/tests src/wheezy/web/middleware/tests \
		src/wheezy/web/tests

doc:
	$(SPHINX) -a -b html doc/ doc/_build/

test-demos:
	$(PYTEST) -q -x --pep8 demos/hello
	make clean po -sC demos/template VERSION=$(VERSION)
	make test -sC demos/template TEMPLATE_ENGINE=jinja2 VERSION=$(VERSION)
	make test -sC demos/template TEMPLATE_ENGINE=mako VERSION=$(VERSION)
	make test -sC demos/template TEMPLATE_ENGINE=tenjin VERSION=$(VERSION)
	make test -sC demos/template TEMPLATE_ENGINE=wheezy.template VERSION=$(VERSION)
	make test -sC demos/template TEMPLATE_ENGINE=wheezy.preprocessor VERSION=$(VERSION)