forked from brian-team/brian2
/
setup.py
63 lines (58 loc) · 2.13 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
#! /usr/bin/env python
'''
Preliminary Brian2 setup script
'''
import sys
import os
from distutils.core import setup
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
class generate_preferences(build_py):
def run(self):
# Make sure we first run the build (including running 2to3 for Python3)
# and then import from the build directory
build_py.run(self)
sys.path.insert(0, self.build_lib)
from brian2.core.preferences import brian_prefs
# We generate the file directly in the build directory
try:
with open(os.path.join(self.build_lib,
'brian2', 'default_preferences'), 'wt') as f:
defaults = brian_prefs.defaults_as_file
f.write(defaults)
except IOError as ex:
raise IOError(('Could not write the default preferences to a '
'file: %s' % str(ex)))
setup(name='Brian2',
version='2.0dev',
packages=['brian2',
'brian2.codegen',
'brian2.codegen.functions',
'brian2.codegen.languages',
'brian2.codegen.runtime',
'brian2.codegen.runtime.numpy_rt',
'brian2.codegen.runtime.weave_rt',
'brian2.core',
'brian2.equations',
'brian2.groups',
'brian2.memory',
'brian2.monitors',
'brian2.parsing',
'brian2.sphinxext',
'brian2.stateupdaters',
'brian2.synapses',
'brian2.tests',
'brian2.units',
'brian2.utils'],
package_data={'brian2.codegen.runtime.numpy_rt': ['templates/*.py_'],
'brian2.codegen.runtime.weave_rt': ['templates/*.cpp']},
requires=['numpy(>=1.4.1)',
'scipy(>=0.7.0)',
'sympy(>=0.7.1)',
'pyparsing',
'jinja2'
],
cmdclass={'build_py': generate_preferences}
)