root/trunk/setup.py

Revision 495, 2.1 kB (checked in by pierre, 3 weeks ago)

Split the NEST 2 packages into two packages: oldnest2 (old pynest API, NEST version < 1.9.7798) and nest2 (new pynest API NEST version >= 1.9.7798). So depending on your NEST 2 version, you'll have to do from pyNN.nest2old import * or from pyNN.nest import *. Note that the new nest2 packages, even if tests are passed, has not been intensively tested, since only few people have updated their NEST version. Note also that there might be errors when setting random parameters to cells, due to the fact that now, NEST 2 is doing some boolean tests when settings parameters. Like for example, is Vm < V_threshold, and so on.... If you just provide a random array without being aware of those tests, you may rise an Exception

Line 
1 #!/usr/bin/env python
2
3 from distutils.core import setup
4 from distutils.command.build import build as _build
5 import os
6
7 class build(_build):
8     """Add nrnivmodl to the end of the build process."""
9
10     def run(self):
11         _build.run(self)
12         nrnivmodl = self.find_nrnivmodl()
13         if nrnivmodl:
14             print "nrnivmodl found at", nrnivmodl
15             import subprocess
16             p = subprocess.Popen(nrnivmodl, shell=True, stdin=subprocess.PIPE,
17                          stdout=subprocess.PIPE, stderr=subprocess.PIPE,
18                          close_fds=True, cwd=os.path.join(os.getcwd(),'build/lib/pyNN/hoc'))
19             result = p.wait()
20             # test if nrnivmodl was successful
21             if result != 0:
22                 errorMsg = p.stderr.readlines()
23                 print "Unable to compile NEURON extensions. Error message was:"
24                 print errorMsg
25             else:
26                 print "Successfully compiled NEURON extensions."
27         else:
28             print "Unable to find nrnivmodl. It will not be possible to use the pyNN.neuron module."
29        
30     def find_nrnivmodl(self):
31         """Try to find the nrnivmodl executable."""
32         path = os.environ.get("PATH", "").split(os.pathsep)
33         nrnivmodl = ''
34         for dir_name in path:
35             abs_name = os.path.abspath(os.path.normpath(os.path.join(dir_name, "nrnivmodl")))
36             if os.path.isfile(abs_name):
37                 nrnivmodl = abs_name
38                 break
39         return nrnivmodl
40      
41 setup(
42     name = "PyNN",
43     version = "0.5.0alpha",
44     package_dir={'pyNN': 'src'},
45     packages = ['pyNN','pyNN.nest2old','pyNN.nest2', 'pyNN.nest1','pyNN.pcsim','pyNN.neuron','pyNN.neuron2','pyNN.brian'],
46     package_data = {'pyNN': ['hoc/*.hoc', 'hoc/*.mod']},
47     author = "The NeuralEnsemble Community",
48     author_email = "pynn@neuralensemble.org",
49     description = "A Python package for simulator-independent specification of neuronal network models",
50     license = "CeCILL",
51     keywords = "computational neuroscience simulation neuron nest pcsim neuroml",
52     url = "http://neuralensemble.org/PyNN/",
53     cmdclass = {'build': build},
54 )
55
Note: See TracBrowser for help on using the browser.