forked from ioam/topographica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
425 lines (322 loc) · 15.1 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
PREFIX = ${CURDIR}/
PYLINT = bin/pylint --rcfile=topo/tests/buildbot/pylintrc
PYCHECKER = bin/pychecker --config doc/buildbot/pycheckrc
GIT_DESCRIBE = $(shell git describe)
RELEASE = $(shell echo ${GIT_DESCRIBE} | cut -d- -f1 | cut -c2-)
GITVERSION = $(shell echo ${GIT_DESCRIBE} | cut -d -f2)
PYTHON = ${PREFIX}/bin/python
PYFLAKES = ${PYTHON} topo/tests/buildbot/pyflakes-ignore.py
# if 0, skips building tk and related external packages
GUI = 1
# set to empty when building 'release' debs.
DEBSTATUS = -unstable
# CEBALERT: tied to exact windows version!
ifeq ("$(shell uname -s)","MINGW32_NT-5.1")
TIMER =
else
TIMER = time
endif
# Commands needed to build a public distribution
COMPRESS_ARCHIVE = gzip
MAKE_ARCHIVE = tar -cf -
MAKE_ZIP = zip -r -q
MKDIR = mkdir -p
SED = sed
RM = rm -f
CD = cd
CP = cp
MV = mv
MAKE = make
# Definitions for public distributions
PROGRAM = topographica
DIST_TMPDIR = ../distributions
DIST_DIRNAME = ${PROGRAM}-${RELEASE}
DIST_DIR = ${DIST_TMPDIR}/${DIST_DIRNAME}
DIST_ARCHIVE = ${DIST_DIRNAME}.tar.gz
DIST_ZIP = ${DIST_DIRNAME}.zip
# Default does not include doc, in case user lacks PHP
default: ext-packages release-file topographica
all: default reference-manual doc tests
# CEBALERT: should be able to remove topo/tests/testsnapshot.typ,
# topo/tests/testplotfilesaver*.png
clean: clean-doc clean-ext-packages clean-compiled clean-coverage-output
${RM} .??*~ *~ */*~ */.??*~ */*/*~ */*/.??*~ */*/*/*~ */*/*/.??*~ *.bak
${RM} .#??*.* */.#??*.* */*/.#??*.* */*/*/.#??*.* current_profile ./topo/tests/testsnapshot.typ ./topo/tests/testplotfilesaver*.png
${RM} -r bin include share lib man ImageSaver*.jpeg python_topo
uninstall:
make -C external uninstall
FORCE:
ext-packages:
make -C external
clean-ext-packages:
make -C external clean
make -C external uninstall
# CB: experimental
topographicagui:
echo "import topo.tkgui;topo.tkgui.start(mainloop=False)" > _gui.py
echo "${PREFIX}bin/idle -n -t 'Topographica shell' -r _gui.py" > topographicagui
echo "" >> topographicagui
chmod a+x ${PREFIX}topographicagui
## Currently useful lint checks
pyflakes: # Everything except topo/tests (where we do lots of importing but not using...)
${PYFLAKES} topo external/param --ignore topo/tests --total
lint-base: # topo.base and param
${PYLINT} topo.base external/param | cat
#CEBALERT: how to get pylint's "ignore" options to work? Upgrade pylint (http://www.logilab.org/ticket/70493)?
# CEBALERT: need to update pychecker and work on its configuration if
# we're going to use it.
check:
${PYCHECKER} external/param/*.py topo/*.py topo/*/*.py
# CEBALERT: way too much output to use.
lint:
${PYLINT} topo external/param
clean-compiled: clean-weave clean-pyc
clean-weave:
rm -rf ~/.python2*_compiled/ | cat
clean-pyc:
rm -f *.pyc external/param/*.pyc external/paramtk/*.pyc topo/*.pyc topo/*/*.pyc topo/*/*/*.pyc examples/*.pyc models/*.pyc contrib/*.pyc
clean-doc:
make -C doc clean
# CEB: If not using fat distribution, can run this command by
# supplying alternative path to epydoc, e.g. "make
# EPYDOC=/path/to/epydoc reference-manual"
reference-manual:
make -C doc reference-manual
doc: FORCE
make -C doc/
# CEBALERT: Move into runtests.py
generate-map-tests-data:
./topographica -c "cortex_density=8" models/lissom_oo_or.ty -c "topo.sim.run(100);from topo.tests.test_map_measurement import *; generate(plotgroups_to_test)"
release-file:
echo ${GIT_DESCRIBE} > topo/.release
#############################################################################
##### tests
#
# Convenience targets for platforms with Make; each of these should
# just call a Python command, and should not be the advertised way to
# do whatever the target does. (Also, note that buildbot no longer uses
# any of these.) I think they could be deleted, but some developers
# are probably used to typing "make slow-tests" or "make tests". Should
# we make it easier to run these targets via python?
all-speed-tests:
./topographica -p timing=True -p 'targets=["speed"]' topo/tests/runtests.py
slow-tests: # all tests except speed tests
./topographica -p 'targets=["all"]' topo/tests/runtests.py
#############################################################################
#############################################################################
##### coverage: intended for buildbot only
clean-coverage-output: clean-coverage-results clean-coverage-html
clean-coverage-results:
${RM} -r .coverage*
# CBALERT: guess at output directory.
clean-coverage-html:
${RM} -r ~/Documents/Topographica/tests/coverage_html
coverage-html:
coverage combine
coverage html --rcfile=doc/buildbot/coveragerc -d ~/Documents/Topographica/tests/coverage_html
#############################################################################
#############################################################################
##### Compare topographica and C++ lissom output
or_comparisons:
./topographica -c "from topo.tests.test_script import run_multiple_density_comparisons;nerr=run_multiple_density_comparisons('lissom_or_reference.ty'); import sys;sys.exit(nerr)"
oo_or_comparisons:
./topographica -c "from topo.tests.test_script import run_multiple_density_comparisons;nerr=run_multiple_density_comparisons('lissom_oo_or_reference.ty'); import sys;sys.exit(nerr)"
## speed test
v_lissom:
make -C topo/tests/reference/
${TIMER}./topographica -c "profiling=True;iterations=20000" topo/tests/reference/lissom_oo_or_reference.ty
#############################################################################
#############################################################################
# For maintainer only; be careful with these commands
## Git-only code release, without making new binaries
## Run these from a relatively clean copy of the topographica directory
## (without stray files, especially in doc/).
# Update any files that keep track of the version number
new-version: FORCE
mv setup.py setup.py~
sed -e "s/version=.*,/version='${RELEASE}',/g" setup.py~ > setup.py
TOPOROOT=https://topographica.svn.sourceforge.net/svnroot/topographica
# Update Topographica.org web site
sf-web-site: reference-manual doc
rsync -v -arHz --rsh=ssh doc/. web.sf.net:/home/groups/t/to/topographica/htdocs/.
EXAMPLES_TO_KEEP_IN_DIST= ^gcal.ty ^hierarchical.ty ^lissom_audio.ty ^perrinet_retina.ty ^ptztracker.ty ^saccade_demo.ty ^som_retinotopy.ty ^tiny.ty
MODELS_TO_KEEP_IN_DIST= ^goodhill_network90.ty ^leaky_lissom_or.ty ^lissom.ty ^lissom_fsa.ty ^lissom_oo_or.ty ^lissom_oo_or_cr.ty ^lissom_or.ty ^lissom_or_movie.ty ^lissom_whisker_barrels.ty ^obermayer_pnas90.ty ^sullivan_neurocomputing04.ty
# Clear out everything not intended for the public distribution
#
# This is ordinarily commented out in the SVN version for safety,
# but it is enabled when the distribution directory is created.
#
#@@distclean: FORCE clean
#@@ ${RM} .#* */.#* */*/.#* */*~
#@@ ${RM} README.rst ; ${CP} platform/distutils/README.setup.txt README.txt
#@@ ${RM} etc/topographica.elc ImageSaver*.ppm countalerts* annotate.out emacslog
#@@ ${RM} current_profile script timing*
#@@ ${RM} examples/*.typ models/*.typ
#@@ ${RM} -r Output
#@@ -mv images/ellen_arthur.pgm ./TMPellen_arthur.pgm
#@@ ${RM} -r images sounds
#@@ ${RM} -r info
#@@ mkdir images; mv ./TMPellen_arthur.pgm images/ellen_arthur.pgm
#@@ ${RM} -r tmp/
#@@ ${RM} -r contrib/
#@@ ${RM} -r .svn */.svn */*/.svn */*/*/.svn */*/*/*/.svn
#@@ ${RM} -r .git* */.git* */*/.git* */*/*/.git* */*/*/*/.git*
#@@ ${CD} topo/tests/reference ; make clean
#@@ ${RM} -r doc/buildbot/
#@@ ${RM} -r platform/debian/
#@@ ${RM} -r external/
#@@ ${RM} -r doc/bib*.blg doc/bib*.bbl doc/bib*.aux
#@@ find examples/*.ty -maxdepth 1 ${subst ^,! -name ,${EXAMPLES_TO_KEEP_IN_DIST}} -exec rm {} \;
#@@ find models/*.ty -maxdepth 1 ${subst ^,! -name ,${MODELS_TO_KEEP_IN_DIST}} -exec rm {} \;
# Make public distribution archive
distarc: FORCE distclean
${CD} .. ; ${RM} -f ${DIST_ZIP} ; ${MAKE_ZIP} ${DIST_ZIP} ${DIST_DIRNAME}
# Create public distribution subdirectory
distdir: FORCE
${RM} -r ${DIST_DIR}
${MKDIR} ${DIST_DIR}
${CP} -r -d . ${DIST_DIR}
${RM} ${DIST_DIR}/Makefile
${SED} \
-e 's|^#@@||' \
Makefile > ${DIST_DIR}/Makefile
# Create public distribution subdirectory and archive
dist: doc distdir reference-manual FORCE
dist: doc distdir FORCE
${CD} ${DIST_DIR}; ${MAKE} distarc
# Note that the output needs to be appended to a copy of the old file,
# to keep old fixes to formatting. The HEAD:XXXXX can be omitted to get
# the full list, but this is faster.
ChangeLog.txt: FORCE
make -C external svn2cl
external/svn2cl -r HEAD:12000 --include-rev --group-by-day --separate-daylogs --break-before-msg --stdout https://topographica.svn.sourceforge.net/svnroot/topographica/ | sed -e 's|/trunk/topographica/||g' > ChangeLog.txt
######################################################################
# Create "pysource", the basis for "python setup.py" distributions
dist-pysource: doc distdir reference-manual
${CD} ${DIST_DIR}; make distclean
${CD} ${DIST_DIR}; ${CP} platform/distutils/README.setup.txt README.txt
${CD} ${DIST_DIR}; ${CP} platform/distutils/setup.py setup.py
${CD} ${DIST_DIR}; ${CP} platform/distutils/MANIFEST.in MANIFEST.in
# won't need to build this copy
${RM} ${DIST_DIR}/Makefile
${RM} -r ${DIST_DIR}/external
# create tar.gz # CEBALERT: can I delete this?
${CD} ${DIST_TMPDIR} ; ${MAKE_ARCHIVE} ${DIST_DIRNAME} | ${COMPRESS_ARCHIVE} > ${DIST_ARCHIVE}
######################################################################
# Public "setup.py"-type distributions
#
# These commands assume you have run "make dist-pysource".
# (Archives don't include doc/ because of its size.)
# CEB: bdist_msi supports silent install, but seems to be missing other options!
BDIST_WIN_CMD = bdist_wininst
# Note: no path to install-script, just name
BDIST_WININST = ${BDIST_WIN_CMD} --user-access-control auto --install-script windows_postinstall.py --plat-name=win
dist-pysource-sdist:
${CD} ${DIST_DIR}; ${PYTHON} setup.py sdist
# generate windows exe (like the exe you get for numpy or matplotlib)
dist-pysource-bdist_wininst:
${CD} ${DIST_DIR}; ${PYTHON} setup.py ${BDIST_WININST}
# CEB: should probably upload to pypi manually, if we're going to do it at all
## put dist onto pypi
#dist-pypi-upload:
# ${CD} ${DIST_DIR}; ${PYTHON} setup.py register sdist ${BDIST_WININST} upload
# CEBALERT: I seem to need these for this 'if' section to be seen by
# make - is that right?
RPM_RELEASE =
UBUNTU_RELEASE =
LOG_TEXT =
# CEBALERT: applies to DEB and RPM; rename
ifeq (${DEBSTATUS},-unstable)
RPM_RELEASE = r${GITVERSION}
UBUNTU_RELEASE = ${RELEASE}~r${GITVERSION}-0ubuntu0
LOG_TEXT = " * Pre-release version ${RELEASE} from SVN; see Changelog.txt for details."
else
# If you want to re-release, need to increment the last digit to
# upload to launchpad. E.g. 0.9.7-0ubuntu0~lucid is first release of
# 0.9.7 on lucid, 0.9.7-0ubuntu1~lucid is second, and so
# on. Presumably there would usually be just one release.
# (Same applies to RPM.)
RPM_RELEASE = 0
UBUNTU_RELEASE = ${RELEASE}-0ubuntu0
LOG_TEXT = " * Version ${RELEASE}; see Changelog.txt for details."
endif
# remove --source-only to try building rpm on your system
rpm:
${CD} ${DIST_DIR}; ${PYTHON} setup.py bdist_rpm --release=${RPM_RELEASE} --requires "python,python-devel,tkinter,numpy,scipy,python-imaging-tk,python-matplotlib,python-matplotlib-tk,ipython" --group="Productivity/Scientific/Other" --source-only
# CEBALERTs about RPM: (1) can't seem to specify python 2.5+! So only
# works where python 2.5+ is the default on a system. (2) where is
# gmpy on FC?
######################################################################
# Ubuntu packages
#
# (1)
# To create build environment:
#
# sudo apt-get install devscripts fakeroot cdbs dput pbuilder alien
# sudo pbuilder create
#
# --- optional, currently unused steps for launchpad
# ln -s doc/buildbot/dot-dput.cf ~/.dput.cf
#
# Set up GPG key, sign Launchpad code of conduct.
# gpg key agent to avoid password requests:
# sudo aptitude install gnupg-agent pinentry-gtk2 pinentry-curses
# export GPGKEY=whatever
# killall -q gpg-agent
# eval $(gpg-agent --daemon)
# ---
#
# See https://wiki.ubuntu.com/PackagingGuide/Complete for more info.
#
# (2)
# These commands must be run with no diffs, and having done "svn
# update" following any commits (so svnversion doesn't end in M or
# have a colon in it).
#
# (3)
# Make the debs, upload, etc. Buildbot's master.cfg is the reference
# for this.
#
# These commands can take a while to run. There's probably some
# redundancy in the creation of the backports.
UBUNTU_ENV = env DEBFULLNAME='C. E. Ball' DEBEMAIL='[email protected]' GPGKEY=6C92B17B
DEBUILD = ${UBUNTU_ENV} debuild -S -sa -uc -us
UBUNTU_TARGET = oneiric
UBUNTU_BACKPORTS = lucid^ maverick^ natty^
UBUNTU_DIR = ${DIST_TMPDIR}/topographica-${UBUNTU_RELEASE}
UBUNTU_CHANGELOG = ${UBUNTU_DIR}/debian/changelog
# You must first have run make dist-pysource. (Not a dependency
# because buildbot runs these targets separately.)
deb:
cd ${DIST_TMPDIR}; cp topographica-${RELEASE}.tar.gz topographica_${UBUNTU_RELEASE}.orig.tar.gz
cd ${DIST_TMPDIR}; mv topographica-${RELEASE} topographica-${UBUNTU_RELEASE}
cp -R platform/debian ${UBUNTU_DIR}/debian
rm -rf ${UBUNTU_DIR}/debian/.svn
echo "topographica (${UBUNTU_RELEASE}~${UBUNTU_TARGET}) ${UBUNTU_TARGET}; urgency=low" > ${UBUNTU_CHANGELOG}
echo "" >> ${UBUNTU_CHANGELOG}
echo ${LOG_TEXT} >> ${UBUNTU_CHANGELOG}
echo "" >> ${UBUNTU_CHANGELOG}
echo " -- C. E. Ball <[email protected]> ${shell date -R}" >> ${UBUNTU_CHANGELOG}
cd ${UBUNTU_DIR}; ${DEBUILD}
# CEBALERT: I never got signing to work without interaction in buildbot
# cd ${DIST_TMPDIR}; ${UBUNTU_ENV} debsign *.changes # CB: could move this line to deb-ppa, since signing only required for ppa
# CB: could put something like this line in to test the build locally
# sudo pbuilder build topographica_${UBUNTU_RELEASE}~${UBUNTU_TARGET}.dsc
# You must first have run 'make deb'.
deb-backports: ${subst ^,_DEB_BACKPORTS,${UBUNTU_BACKPORTS}}
%_DEB_BACKPORTS:
cd ${UBUNTU_DIR}/debian; cp changelog ../../changelog.orig
cd ${UBUNTU_DIR}/debian; cp control ../../control.orig;
cd ${UBUNTU_DIR}/debian; rm changelog*; cp ../../changelog.orig changelog
cd ${UBUNTU_DIR}; ${UBUNTU_ENV} debchange --force-bad-version --newversion "${UBUNTU_RELEASE}~$*" --force-distribution --distribution $* "Backport to $*."
cd ${UBUNTU_DIR}; ${DEBUILD}
# revert changes made for backports
cd ${UBUNTU_DIR}/debian; cp ../../changelog.orig changelog
# Requires that you have first run make deb, deb-backports
deb-ppa: ${subst ^,_DPUT,${UBUNTU_BACKPORTS} ${UBUNTU_TARGET}^}
%_DPUT:
cd ${DIST_TMPDIR}; dput topographica${DEBSTATUS}-force-$* topographica_${UBUNTU_RELEASE}~$*_source.changes
## CEBALERT: need to clean up this section, and rpm is totally untested
#rpm-svn:
## Does it need sudo?
# cd ${DIST_TMPDIR}; alien -r topographica_${UBUNTU_RELEASE}~${UBUNTU_TARGET}_all.deb