-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
170 lines (150 loc) · 6.63 KB
/
Makefile
File metadata and controls
170 lines (150 loc) · 6.63 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# === makefile ------------------------------------------------------------===
# Copyright © 2011-2012, RokuSigma Inc. and contributors. See AUTHORS for more
# details.
#
# Some rights reserved.
#
# Redistribution and use in source and binary forms of the software as well as
# documentation, with or without modification, are permitted provided that the
# following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * The names of the copyright holders or contributors may not be used to
# endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND
# DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ===----------------------------------------------------------------------===
ROOT=$(shell pwd)
CACHE_ROOT=${ROOT}/.cache
PKG_ROOT=${ROOT}/.pkg
-include Makefile.local
.PHONY: all
all: ${PKG_ROOT}/.stamp-h
.PHONY: check
check: all
mkdir -p build/report/xunit
@echo >.pytest.py "import unittest2"
@echo >>.pytest.py "import xmlrunner"
@echo >>.pytest.py "unittest2.main("
@echo >>.pytest.py " testRunner=xmlrunner.XMLTestRunner("
@echo >>.pytest.py " output='build/report/xunit'),"
@echo >>.pytest.py " argv=['unit2', 'discover',"
@echo >>.pytest.py " '-s','python_patterns',"
@echo >>.pytest.py " '-p','*.py',"
@echo >>.pytest.py " '-t','.',"
@echo >>.pytest.py " ]"
@echo >>.pytest.py ")"
chmod +x .pytest.py
"${PKG_ROOT}"/bin/coverage run .pytest.py || { rm -f .pytest.py; exit 1; }
"${PKG_ROOT}"/bin/coverage xml --omit=".pytest.py" -o build/report/coverage.xml
rm -f .pytest.py
.PHONY: debugcheck
debugcheck: all
mkdir -p build/report/xunit
@echo >.pytest.py "import unittest2"
@echo >>.pytest.py "import xmlrunner"
@echo >>.pytest.py "import exceptions, ipdb, sys"
@echo >>.pytest.py "class PDBAssertionError(exceptions.AssertionError):"
@echo >>.pytest.py " def __init__(self, *args):"
@echo >>.pytest.py " exceptions.AssertionError.__init__(self, *args)"
@echo >>.pytest.py " print 'Assertion failed, entering PDB...'"
@echo >>.pytest.py " if hasattr(sys, '_getframe'):"
@echo >>.pytest.py " ipdb.set_trace(sys._getframe().f_back.f_back.f_back)"
@echo >>.pytest.py " else:"
@echo >>.pytest.py " ipdb.set_trace()"
@echo >>.pytest.py "unittest2.TestCase.failureException = PDBAssertionError"
@echo >>.pytest.py "unittest2.main("
@echo >>.pytest.py " testRunner=xmlrunner.XMLTestRunner("
@echo >>.pytest.py " output='build/report/xunit'),"
@echo >>.pytest.py " argv=['unit2', 'discover',"
@echo >>.pytest.py " '-s','python_patterns',"
@echo >>.pytest.py " '-p','*.py',"
@echo >>.pytest.py " '-t','.',"
@echo >>.pytest.py " ]"
@echo >>.pytest.py ")"
@chmod +x .pytest.py
"${PKG_ROOT}"/bin/coverage run .pytest.py || { rm -f .pytest.py; exit 1; }
"${PKG_ROOT}"/bin/coverage xml --omit=".pytest.py" -o build/report/coverage.xml
rm -f .pytest.py
.PHONY: shell
shell: all
"${PKG_ROOT}"/bin/ipython
.PHONY: mostlyclean
mostlyclean:
-rm -rf dist
-rm -rf build
-rm -rf .coverage
.PHONY: clean
clean: mostlyclean
-rm -rf "${PKG_ROOT}"
.PHONY: distclean
distclean: clean
-rm -rf "${CACHE_ROOT}"
.PHONY: maintainer-clean
maintainer-clean: distclean
@echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.'
.PHONY: dist
dist:
"${PKG_ROOT}"/bin/python setup.py sdist
# ===--------------------------------------------------------------------===
${CACHE_ROOT}/virtualenv/virtualenv-1.7.1.2.tar.gz:
mkdir -p ${CACHE_ROOT}/virtualenv
sh -c "cd ${CACHE_ROOT}/virtualenv && curl -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.1.2.tar.gz"
${PKG_ROOT}/.stamp-h: conf/requirements*.pip ${CACHE_ROOT}/virtualenv/virtualenv-1.7.1.2.tar.gz
# Because build and run-time dependencies are not thoroughly tracked,
# it is entirely possible that rebuilding the development environment
# on top of an existing one could result in a broken build. For the
# sake of consistency and preventing unnecessary, difficult-to-debug
# problems, the entire development environment is rebuilt from scratch
# everytime this make target is selected.
${MAKE} clean
# The ``${PKG_ROOT}`` directory, if it exists, is removed by the
# ``clean`` target. The PyPI cache is nonexistant if this is a freshly
# checked-out repository, or if the ``distclean`` target has been run.
# This might cause problems with build scripts executed later which
# assume their existence, so they are created now if they don't
# already exist.
mkdir -p "${PKG_ROOT}"
mkdir -p "${CACHE_ROOT}"/pypi
# ``virtualenv`` is used to create a separate Python installation for
# this project in ``${PKG_ROOT}``.
tar \
-C "${CACHE_ROOT}"/virtualenv --gzip \
-xf "${CACHE_ROOT}"/virtualenv/virtualenv-1.7.1.2.tar.gz
python "${CACHE_ROOT}"/virtualenv/virtualenv-1.7.1.2/virtualenv.py \
--clear \
--distribute \
--never-download \
--prompt="(python-patterns) " \
"${PKG_ROOT}"
-rm -rf "${CACHE_ROOT}"/virtualenv/virtualenv-1.7.1.2
# readline is installed here to get around a bug on Mac OS X which is
# causing readline to not build properly if installed from pip.
"${PKG_ROOT}"/bin/easy_install readline
# pip is used to install Python dependencies for this project.
for reqfile in conf/requirements*.pip; do \
"${PKG_ROOT}"/bin/python "${PKG_ROOT}"/bin/pip install \
--download-cache="${CACHE_ROOT}"/pypi \
-r $$reqfile; \
done
# All done!
touch "${PKG_ROOT}"/.stamp-h
# ===--------------------------------------------------------------------===
# End of File
# ===--------------------------------------------------------------------===