forked from roskakori/cutplace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
173 lines (154 loc) · 6.35 KB
/
build.xml
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
171
172
173
<project name="cutplace" default="bdist_egg" basedir=".">
<description>Buildfile for cutplace</description>
<!-- Set global properties for this build. -->
<property name="source" location="${basedir}/source" />
<property name="tests.dir" location="${basedir}/tests" />
<property name="tests-results.dir" location="${tests.dir}/results" />
<property name="build" location="${basedir}/build" />
<property name="dist" location="${basedir}/dist" />
<!-- Property to access environment variables. -->
<property environment="env" />
<macrodef name="pyst">
<!-- Macro to run a setup.py command. -->
<attribute name="command" />
<sequential>
<exec executable="python" failonerror="true">
<arg file="setup.py" />
<arg value="@{command}" />
</exec>
</sequential>
</macrodef>
<macrodef name="torst">
<!-- Macro to run convert a data file to ReStructured text. -->
<attribute name="cid" />
<attribute name="data" />
<attribute name="rst" />
<sequential>
<exec executable="python" failonerror="true">
<env key="PYTHONPATH" value="."/>
<arg file="tests/dev_torst.py" />
<arg file="@{cid}" />
<arg file="@{data}" />
<arg file="@{rst}" />
</exec>
</sequential>
</macrodef>
<target name="develop" depends="bdist_wheel" description="install current development version">
<tstamp />
<pyst command="develop" />
</target>
<target name="install" depends="bdist_wheel" description="install binary distribution">
<tstamp />
<pyst command="install" />
</target>
<target name="sdist" depends="bdist_wheel" description="build source distribution">
<!-- Delete Mac OS X Finder cache files. -->
<delete>
<fileset defaultexcludes="false" dir="." includes="**/.DS_Store" />
</delete>
<exec executable="python" failonerror="true">
<arg file="setup.py" />
<arg value="sdist" />
<arg value="--formats=zip" />
</exec>
</target>
<target name="sdist_upload" depends="bdist_wheel" description="build source distribution">
<!-- Delete Mac OS X Finder cache files. -->
<delete>
<fileset defaultexcludes="false" dir="." includes="**/.DS_Store" />
</delete>
<exec executable="python" failonerror="true">
<arg file="setup.py" />
<arg value="sdist" />
<arg value="--formats=zip" />
<arg value="upload" />
</exec>
</target>
<target name="bdist_wheel" depends="docs" description="build binary distribution">
<tstamp />
<exec executable="python" failonerror="true">
<arg file="setup.py" />
<arg value="bdist_wheel" />
<arg value="--universal" />
</exec>
</target>
<target name="bdist_wheel_upload" depends="docs" description="build binary distribution and upload it to PyPI">
<tstamp />
<exec executable="python" failonerror="true">
<arg file="setup.py" />
<arg value="bdist_wheel" />
<arg value="--universal" />
<arg value="upload" />
</exec>
</target>
<target name="unittest" description="run unit tests">
<exec executable="python" failonerror="true">
<arg file="setup.py" />
<arg value="test" />
</exec>
</target>
<target name="htmlcov" description="run unit tests and built HTML coverage report in folder htmlcov">
<exec executable="python" failonerror="true">
<arg path="setup.py" />
<arg value="test" />
<arg value="--cov-html" />
<arg file="." />
</exec>
</target>
<target name="doctest" description="run doctests">
<exec executable="python" failonerror="true">
<arg path="setup.py" />
<arg value="doctest" />
</exec>
</target>
<target name="test_docs" description="run examples in documentation">
<exec dir="tests" executable="python" failonerror="true">
<env key="PYTHONPATH" path="${basedir}:${env.PYTHONPATH}" />
<arg value="-m" />
<arg value="doctest" />
<arg value="--fail-fast" />
<arg file="docs/api.rst" />
</exec>
</target>
<target name="test" description="run test suite" depends="unittest, doctest, test_docs, flake8" />
<target name="performance" description="run performance test">
<exec executable="nosetests" failonerror="false">
<arg value="--with-xunit" />
<arg value="--xunit-file" />
<arg file="nosetests_performance.xml" />
<arg file="tests/test_performance.py" />
</exec>
</target>
<target name="clean" description="clean up">
<!-- Delete files and folders generated by target "bdist". -->
<pyst command="clean" />
<delete>
<fileset dir="." includes="**/*.pyc, **/*$py.class" />
<fileset dir="." includes="coverage.xml, nosetests.xml, nosetests_performance.xml, flake8.txt" />
</delete>
<delete includeemptydirs="true">
<fileset dir="${tests-results.dir}" includes="**/*" />
</delete>
<delete dir="${build}" />
<delete dir="htmlcov" />
</target>
<target description="build documentation" name="docs">
<torst cid="examples/cid_customers.ods" data="examples/customers.csv" rst="docs/include/customers.rst" />
<torst cid="examples/cid_customers.ods" data="examples/customers_without_date_of_birth.csv" rst="docs/include/customers_without_date_of_birth.rst" />
<pyst command="docs" />
</target>
<target name="flake8" description="build flake8 violations report">
<echo message="build flake8 violations report" />
<exec executable="flake8" failonerror="true">
<arg value="--config" />
<arg file="tox.ini" />
<arg file="setup.py" />
<arg file="cutplace" />
<arg file="tests" />
<redirector error="flake8.txt" output="flake8.txt" />
</exec>
<concat>
<filelist files="flake8.txt"/>
</concat>
</target>
</project>