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