-
Notifications
You must be signed in to change notification settings - Fork 32
/
setup.py
229 lines (187 loc) · 7.33 KB
/
setup.py
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
#!/usr/bin/env python
import sys
from distutils.core import setup
from distutils.extension import Extension
import glob
import numpy
try:
from Cython.Distutils import build_ext
except:
build_ext = None
examples = glob.glob('examples/*.ty')
models = glob.glob('models/*.ty')
scripts = ['topographica']
### TOPOGRAPHICA DEPENDENCIES ########################################
required = {'PIL':">=1.1.6",
'numpy':">=1.0",
'param':">=1.0",
'paramtk':">=0.8",
'imagen':">=1.0"}
optional = {'cython': '>=0.2',
'weave': '>=0.15',
'gmpy':'>=1.0',
'matplotlib':'>=0.8',
'ipython':">=0.7"}
# for pip/easy_install (just go for the basics until easy_install works better!)
packages_to_install = [required]
packages_to_state = [required]
######################################################################
setup_args = {}
ext_modules = [
Extension("topo.optimized.optimized", ["topo/optimized/optimized.pyx"],
extra_compile_args=['-fopenmp', '-O2', '-Wno-unused-variable',
'-fomit-frame-pointer','-funroll-loops'],
extra_link_args=['-fopenmp', '-lstdc++'],
include_dirs=[numpy.get_include()]),
Extension("topo.sparse.sparse", ["topo/sparse/sparse.pyx"],
language="c++", extra_link_args=['-lgomp'],
extra_compile_args= ["-w","-O2","-fopenmp","-DNDEBUG","-msse2"],
include_dirs=[numpy.get_include(), 'external/eigen3'])]
if 'setuptools' in sys.modules:
# support easy_install without depending on setuptools
install_requires = []
for package_list in packages_to_install:
install_requires+=["%s%s"%(package,version) for package,version in package_list.items()]
setup_args['install_requires']=install_requires
setup_args['dependency_links']=["http://pypi.python.org/simple/"]
setup_args['zip_safe']=False
for package_list in packages_to_state:
requires = []
requires+=["%s (%s)"%(package,version) for package,version in package_list.items()]
setup_args['requires']=requires
if 'bdist_wininst' in sys.argv:
scripts.append('platform/windows/windows_postinstall.py')
# CEBALERT: how else to get the ico into a place the postinstall script can find?!
scripts.append("platform/windows/topographica.ico")
TRAINSCRIPTS = [
"hierarchical.ty",
"lissom_or.ty",
"lissom_oo_or.ty",
"som_retinotopy.ty",
"sullivan_neurocomputing04.ty",
"lissom.ty",
"lissom_fsa.ty",
"gcal.ty"
]
_topographica_devs='Topographica Developers'
_topographica_devs_email='developers[at]topographica[dot]org'
setup_args.update(dict(
name='topographica',
# CEBALERT: we need one single place with the version number!
#
# This release number is usually 1 higher than the Makefile's,
# except when the Makefile is updated just prior to release. This
# is because DEBs etc being built between releases have a release
# number of the next release combined with the svn revision
# number, to match DEB convention. (Whereas for svn copy we are
# using the opposite convention...)
version="0.9.8",
description='A general-purpose neural simulator focusing on topographic maps.',
long_description="""
`Topographica`_ is a software package for computational modeling of
neural maps. The goal is to help researchers understand brain function
at the level of the topographic maps that make up sensory and motor
systems.
Please see http://topographica.org/ for more information.
Installation
============
Please see http://topographica.org/Downloads for more complete
instructions; a brief summary for installation into an existing
Python environment is given here.
If you have `pip`_, you can use one of
those to install Topographica and its dependencies automatically
(e.g. ``pip install topographica``).
Alternatively, you can download and unpack the archive below, and then
install Topographica with a command like ``python setup.py install``
(e.g. ``sudo python setup.py install`` for a site-wide installation,
or ``python setup.py install --user`` to install into
``~/.local``). You will need to install at least `NumPy`_, `PIL`_,
`Param`_, `ParamTk`_, and `ImaGen`_, before running Topographica. We
also recommend that you install `MatPlotLib`_ so you can access all
Topographica's plots, as well as `GmPy`_ and Weave (available as part
of `SciPy`_) for optimum performance.
.. _Topographica:
http://topographica.org/Home/
.. _NumPy:
http://pypi.python.org/pypi/numpy
.. _Gmpy:
http://pypi.python.org/pypi/gmpy
.. _SciPy:
http://pypi.python.org/pypi/scipy
.. _MatPlotLib:
http://pypi.python.org/pypi/matplotlib
.. _PIL:
http://pypi.python.org/pypi/PIL
.. _pip:
http://pip.openplans.org/
.. _Param:
http://ioam.github.io/param/
.. _ParamTk:
http://ioam.github.io/paramtk/
.. _ImaGen:
http://ioam.github.io/imagen/
""",
author= _topographica_devs,
author_email= _topographica_devs_email,
maintainer= _topographica_devs,
maintainer_email= _topographica_devs_email,
platforms=['Windows', 'Mac OS X', 'Linux'],
license='BSD',
# download_url='http://sourceforge.net/projects/topographica/files/',
url='http://topographica.org/',
classifiers = [
"License :: OSI Approved :: BSD License",
# (until packaging tested)
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Operating System :: OS Independent",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Topic :: Education",
"Topic :: Scientific/Engineering"],
# CEBALERT: do I have to list these? if I do, can I generate the list automatically?
packages=['topo',
'topo.analysis',
'topo.base',
'topo.command',
'topo.coordmapper',
'topo.learningfn',
'topo.misc',
'topo.optimized',
'topo.plotting',
'topo.projection',
'topo.responsefn',
'topo.sheet',
'topo.sparse',
'topo.tests',
'topo.tkgui',
'topo.transferfn'],
package_data={
# CB: These things are not data, but there's currently no
# other mechanism in distutils/setuptools.
'': ['topographica'],
'topo.tkgui': ['icons/*.*'],
'topo.command':['*.png','*.pdf'],
'topo.tests':['*.txt','*.jpg','*.pgm']+[s+"_DATA" for s in TRAINSCRIPTS]+['*.data']+['*.typ']+['*.pickle']},
data_files=[('share/topographica/examples',examples),
('share/topographica/models',models)],
scripts = scripts,
script_args = ['--quiet', 'build_ext'],
cmdclass = {'build_ext': build_ext} if build_ext else {},
ext_modules = ext_modules))
# Help text for dependencies not PIP
def help_dependency(package):
print "The required package %s is not installed on your system." % package
if __name__ == "__main__":
try:
import numpy
except ImportError:
help_dependency(package)
sys.exit(1)
# When creating a release, check the version is set correctly.
if 'upload' in sys.argv:
import topo
topo.__version__.verify(setup_args['version'])
setup(**setup_args)