p@21: PYTHON = $(shell test -x bin/python && echo bin/python || \ p@21: echo `which python`) p@21: PYVERS = $(shell $(PYTHON) -c 'import sys; print "%s.%s" % sys.version_info[0:2]') p@21: VIRTUALENV = $(shell /bin/echo -n `which virtualenv || \ p@21: which virtualenv-$(PYVERS) || \ p@21: which virtualenv$(PYVERS)`) p@21: VIRTUALENV += --no-site-packages p@21: PAGER ?= less p@21: DEPS := $(shell find $(PWD)/deps -type f -printf "file://%p ") p@21: COVERAGE = $(shell test -x bin/coverage && echo bin/coverage || echo true) p@21: SETUP = $(PYTHON) ./setup.py p@21: EZ_INSTALL = $(SETUP) easy_install -f "$(DEPS)" p@21: PYLINT = bin/pylint p@21: PLATFORM = $(shell $(PYTHON) -c "from pkg_resources import get_build_platform; print get_build_platform()") p@21: OS := $(shell uname) p@21: EGG := $(shell $(SETUP) --fullname)-py$(PYVERS).egg p@21: SDIST := $(shell $(SETUP) --fullname).tar.gs p@21: SRCDIR := oauth2 p@21: SOURCES := $(shell find $(SRCDIR) -type f -name \*.py -not -name 'test_*') p@21: TESTS := $(shell find $(SRCDIR) -type f -name test_\*.py) p@21: COVERED := $(SOURCES) p@21: ROOT = $(shell pwd) p@21: ROOTCMD = fakeroot p@21: SIGN_KEY ?= nerds@simplegeo.com p@21: BUILD_NUMBER ?= 1 p@21: p@21: p@21: .PHONY: test dev clean extraclean debian/changelog p@21: p@21: all: egg p@21: egg: dist/$(EGG) p@21: p@21: dist/$(EGG): p@21: $(SETUP) bdist_egg p@21: p@21: sdist: p@21: $(SETUP) sdist p@21: p@21: debian/changelog: p@21: -git branch -D changelog p@21: git checkout -b changelog p@21: git-dch -a -N $(shell $(SETUP) --version) --debian-branch changelog \ p@21: --snapshot --snapshot-number=$(BUILD_NUMBER) p@21: p@21: deb: debian/changelog p@21: test -d dist/deb || mkdir -p dist/deb p@21: dpkg-buildpackage -r$(ROOTCMD) -k$(SIGN_KEY) p@21: mv ../python-oauth2_* dist/deb p@21: p@21: test: p@21: $(SETUP) test --with-coverage --cover-package=oauth2 p@21: p@21: sdist: p@21: python setup.py sdist p@21: p@21: xunit.xml: bin/nosetests $(SOURCES) $(TESTS) p@21: $(SETUP) test --with-xunit --xunit-file=$@ p@21: p@21: bin/nosetests: bin/easy_install p@21: @$(EZ_INSTALL) nose p@21: p@21: coverage: .coverage p@21: @$(COVERAGE) html -d $@ $(COVERED) p@21: p@21: coverage.xml: .coverage p@21: @$(COVERAGE) xml $(COVERED) p@21: p@21: .coverage: $(SOURCES) $(TESTS) bin/coverage bin/nosetests p@21: -@$(COVERAGE) run $(SETUP) test p@21: p@21: bin/coverage: bin/easy_install p@21: @$(EZ_INSTALL) coverage p@21: p@21: profile: .profile bin/pyprof2html p@21: bin/pyprof2html -o $@ $< p@21: p@21: .profile: $(SOURCES) bin/nosetests p@21: -$(SETUP) test -q --with-profile --profile-stats-file=$@ p@21: p@21: bin/pyprof2html: bin/easy_install bin/ p@21: @$(EZ_INSTALL) pyprof2html p@21: p@21: docs: $(SOURCES) bin/epydoc p@21: @echo bin/epydoc -q --html --no-frames -o $@ ... p@21: @bin/epydoc -q --html --no-frames -o $@ $(SOURCES) p@21: p@21: bin/epydoc: bin/easy_install p@21: @$(EZ_INSTALL) epydoc p@21: p@21: bin/pep8: bin/easy_install p@21: @$(EZ_INSTALL) pep8 p@21: p@21: pep8: bin/pep8 p@21: @bin/pep8 --repeat --ignore E225 $(SRCDIR) p@21: p@21: pep8.txt: bin/pep8 p@21: @bin/pep8 --repeat --ignore E225 $(SRCDIR) > $@ p@21: p@21: lint: bin/pylint p@21: -$(PYLINT) -f colorized $(SRCDIR) p@21: p@21: lint.html: bin/pylint p@21: -$(PYLINT) -f html $(SRCDIR) > $@ p@21: p@21: lint.txt: bin/pylint p@21: -$(PYLINT) -f parseable $(SRCDIR) > $@ p@21: p@21: bin/pylint: bin/easy_install p@21: @$(EZ_INSTALL) pylint p@21: p@21: README.html: README.mkd | bin/markdown p@21: bin/markdown -e utf-8 $^ -f $@ p@21: p@21: bin/markdown: bin/easy_install p@21: @$(EZ_INSTALL) Markdown p@21: p@21: p@21: # Development setup p@21: rtfm: p@21: $(PAGER) README.mkd p@21: p@21: tags: TAGS.gz p@21: p@21: TAGS.gz: TAGS p@21: gzip $^ p@21: p@21: TAGS: $(SOURCES) p@21: ctags -eR . p@21: p@21: env: bin/easy_install p@21: p@21: bin/easy_install: p@21: $(VIRTUALENV) . p@21: -test -f deps/setuptools* && $@ -U deps/setuptools* p@21: p@21: dev: develop p@21: develop: env p@21: nice -n 20 $(SETUP) develop p@21: @echo " ---------------------------------------------" p@21: @echo " To activate the development environment, run:" p@21: @echo " . bin/activate" p@21: @echo " ---------------------------------------------" p@21: p@21: clean: p@21: clean: p@21: find . -type f -name \*.pyc -exec rm {} \; p@21: rm -rf build dist TAGS TAGS.gz digg.egg-info tmp .coverage \ p@21: coverage coverage.xml docs lint.html lint.txt profile \ p@21: .profile *.egg xunit.xml p@21: @if test "$(OS)" = "Linux"; then $(ROOTCMD) debian/rules clean; fi p@21: p@21: p@21: xclean: extraclean p@21: extraclean: clean p@21: rm -rf bin lib .Python include