p@21
|
1 PYTHON = $(shell test -x bin/python && echo bin/python || \
|
p@21
|
2 echo `which python`)
|
p@21
|
3 PYVERS = $(shell $(PYTHON) -c 'import sys; print "%s.%s" % sys.version_info[0:2]')
|
p@21
|
4 VIRTUALENV = $(shell /bin/echo -n `which virtualenv || \
|
p@21
|
5 which virtualenv-$(PYVERS) || \
|
p@21
|
6 which virtualenv$(PYVERS)`)
|
p@21
|
7 VIRTUALENV += --no-site-packages
|
p@21
|
8 PAGER ?= less
|
p@21
|
9 DEPS := $(shell find $(PWD)/deps -type f -printf "file://%p ")
|
p@21
|
10 COVERAGE = $(shell test -x bin/coverage && echo bin/coverage || echo true)
|
p@21
|
11 SETUP = $(PYTHON) ./setup.py
|
p@21
|
12 EZ_INSTALL = $(SETUP) easy_install -f "$(DEPS)"
|
p@21
|
13 PYLINT = bin/pylint
|
p@21
|
14 PLATFORM = $(shell $(PYTHON) -c "from pkg_resources import get_build_platform; print get_build_platform()")
|
p@21
|
15 OS := $(shell uname)
|
p@21
|
16 EGG := $(shell $(SETUP) --fullname)-py$(PYVERS).egg
|
p@21
|
17 SDIST := $(shell $(SETUP) --fullname).tar.gs
|
p@21
|
18 SRCDIR := oauth2
|
p@21
|
19 SOURCES := $(shell find $(SRCDIR) -type f -name \*.py -not -name 'test_*')
|
p@21
|
20 TESTS := $(shell find $(SRCDIR) -type f -name test_\*.py)
|
p@21
|
21 COVERED := $(SOURCES)
|
p@21
|
22 ROOT = $(shell pwd)
|
p@21
|
23 ROOTCMD = fakeroot
|
p@21
|
24 SIGN_KEY ?= nerds@simplegeo.com
|
p@21
|
25 BUILD_NUMBER ?= 1
|
p@21
|
26
|
p@21
|
27
|
p@21
|
28 .PHONY: test dev clean extraclean debian/changelog
|
p@21
|
29
|
p@21
|
30 all: egg
|
p@21
|
31 egg: dist/$(EGG)
|
p@21
|
32
|
p@21
|
33 dist/$(EGG):
|
p@21
|
34 $(SETUP) bdist_egg
|
p@21
|
35
|
p@21
|
36 sdist:
|
p@21
|
37 $(SETUP) sdist
|
p@21
|
38
|
p@21
|
39 debian/changelog:
|
p@21
|
40 -git branch -D changelog
|
p@21
|
41 git checkout -b changelog
|
p@21
|
42 git-dch -a -N $(shell $(SETUP) --version) --debian-branch changelog \
|
p@21
|
43 --snapshot --snapshot-number=$(BUILD_NUMBER)
|
p@21
|
44
|
p@21
|
45 deb: debian/changelog
|
p@21
|
46 test -d dist/deb || mkdir -p dist/deb
|
p@21
|
47 dpkg-buildpackage -r$(ROOTCMD) -k$(SIGN_KEY)
|
p@21
|
48 mv ../python-oauth2_* dist/deb
|
p@21
|
49
|
p@21
|
50 test:
|
p@21
|
51 $(SETUP) test --with-coverage --cover-package=oauth2
|
p@21
|
52
|
p@21
|
53 sdist:
|
p@21
|
54 python setup.py sdist
|
p@21
|
55
|
p@21
|
56 xunit.xml: bin/nosetests $(SOURCES) $(TESTS)
|
p@21
|
57 $(SETUP) test --with-xunit --xunit-file=$@
|
p@21
|
58
|
p@21
|
59 bin/nosetests: bin/easy_install
|
p@21
|
60 @$(EZ_INSTALL) nose
|
p@21
|
61
|
p@21
|
62 coverage: .coverage
|
p@21
|
63 @$(COVERAGE) html -d $@ $(COVERED)
|
p@21
|
64
|
p@21
|
65 coverage.xml: .coverage
|
p@21
|
66 @$(COVERAGE) xml $(COVERED)
|
p@21
|
67
|
p@21
|
68 .coverage: $(SOURCES) $(TESTS) bin/coverage bin/nosetests
|
p@21
|
69 -@$(COVERAGE) run $(SETUP) test
|
p@21
|
70
|
p@21
|
71 bin/coverage: bin/easy_install
|
p@21
|
72 @$(EZ_INSTALL) coverage
|
p@21
|
73
|
p@21
|
74 profile: .profile bin/pyprof2html
|
p@21
|
75 bin/pyprof2html -o $@ $<
|
p@21
|
76
|
p@21
|
77 .profile: $(SOURCES) bin/nosetests
|
p@21
|
78 -$(SETUP) test -q --with-profile --profile-stats-file=$@
|
p@21
|
79
|
p@21
|
80 bin/pyprof2html: bin/easy_install bin/
|
p@21
|
81 @$(EZ_INSTALL) pyprof2html
|
p@21
|
82
|
p@21
|
83 docs: $(SOURCES) bin/epydoc
|
p@21
|
84 @echo bin/epydoc -q --html --no-frames -o $@ ...
|
p@21
|
85 @bin/epydoc -q --html --no-frames -o $@ $(SOURCES)
|
p@21
|
86
|
p@21
|
87 bin/epydoc: bin/easy_install
|
p@21
|
88 @$(EZ_INSTALL) epydoc
|
p@21
|
89
|
p@21
|
90 bin/pep8: bin/easy_install
|
p@21
|
91 @$(EZ_INSTALL) pep8
|
p@21
|
92
|
p@21
|
93 pep8: bin/pep8
|
p@21
|
94 @bin/pep8 --repeat --ignore E225 $(SRCDIR)
|
p@21
|
95
|
p@21
|
96 pep8.txt: bin/pep8
|
p@21
|
97 @bin/pep8 --repeat --ignore E225 $(SRCDIR) > $@
|
p@21
|
98
|
p@21
|
99 lint: bin/pylint
|
p@21
|
100 -$(PYLINT) -f colorized $(SRCDIR)
|
p@21
|
101
|
p@21
|
102 lint.html: bin/pylint
|
p@21
|
103 -$(PYLINT) -f html $(SRCDIR) > $@
|
p@21
|
104
|
p@21
|
105 lint.txt: bin/pylint
|
p@21
|
106 -$(PYLINT) -f parseable $(SRCDIR) > $@
|
p@21
|
107
|
p@21
|
108 bin/pylint: bin/easy_install
|
p@21
|
109 @$(EZ_INSTALL) pylint
|
p@21
|
110
|
p@21
|
111 README.html: README.mkd | bin/markdown
|
p@21
|
112 bin/markdown -e utf-8 $^ -f $@
|
p@21
|
113
|
p@21
|
114 bin/markdown: bin/easy_install
|
p@21
|
115 @$(EZ_INSTALL) Markdown
|
p@21
|
116
|
p@21
|
117
|
p@21
|
118 # Development setup
|
p@21
|
119 rtfm:
|
p@21
|
120 $(PAGER) README.mkd
|
p@21
|
121
|
p@21
|
122 tags: TAGS.gz
|
p@21
|
123
|
p@21
|
124 TAGS.gz: TAGS
|
p@21
|
125 gzip $^
|
p@21
|
126
|
p@21
|
127 TAGS: $(SOURCES)
|
p@21
|
128 ctags -eR .
|
p@21
|
129
|
p@21
|
130 env: bin/easy_install
|
p@21
|
131
|
p@21
|
132 bin/easy_install:
|
p@21
|
133 $(VIRTUALENV) .
|
p@21
|
134 -test -f deps/setuptools* && $@ -U deps/setuptools*
|
p@21
|
135
|
p@21
|
136 dev: develop
|
p@21
|
137 develop: env
|
p@21
|
138 nice -n 20 $(SETUP) develop
|
p@21
|
139 @echo " ---------------------------------------------"
|
p@21
|
140 @echo " To activate the development environment, run:"
|
p@21
|
141 @echo " . bin/activate"
|
p@21
|
142 @echo " ---------------------------------------------"
|
p@21
|
143
|
p@21
|
144 clean:
|
p@21
|
145 clean:
|
p@21
|
146 find . -type f -name \*.pyc -exec rm {} \;
|
p@21
|
147 rm -rf build dist TAGS TAGS.gz digg.egg-info tmp .coverage \
|
p@21
|
148 coverage coverage.xml docs lint.html lint.txt profile \
|
p@21
|
149 .profile *.egg xunit.xml
|
p@21
|
150 @if test "$(OS)" = "Linux"; then $(ROOTCMD) debian/rules clean; fi
|
p@21
|
151
|
p@21
|
152
|
p@21
|
153 xclean: extraclean
|
p@21
|
154 extraclean: clean
|
p@21
|
155 rm -rf bin lib .Python include
|