| 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.STDOUT, |
|---|
| 18 | close_fds=True, cwd=os.path.join(os.getcwd(), self.build_lib, 'pyNN/neuron/nmodl')) |
|---|
| 19 | stdout = p.stdout.readlines() |
|---|
| 20 | result = p.wait() |
|---|
| 21 | # test if nrnivmodl was successful |
|---|
| 22 | if result != 0: |
|---|
| 23 | print "Unable to compile NEURON extensions. Output was:" |
|---|
| 24 | print ' '.join([''] + stdout) # indent error msg for easy comprehension |
|---|
| 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.8.0dev", |
|---|
| 44 | package_dir={'pyNN': 'src'}, |
|---|
| 45 | packages = ['pyNN','pyNN.nest', 'pyNN.pcsim', 'pyNN.neuron', 'pyNN.nineml', |
|---|
| 46 | 'pyNN.brian','pyNN.nemo', 'pyNN.common', |
|---|
| 47 | 'pyNN.recording', 'pyNN.standardmodels', 'pyNN.descriptions', |
|---|
| 48 | 'pyNN.nest.standardmodels', 'pyNN.pcsim.standardmodels', |
|---|
| 49 | 'pyNN.neuron.standardmodels', 'pyNN.brian.standardmodels', 'pyNN.nemo.standardmodels'], |
|---|
| 50 | package_data = {'pyNN': ['neuron/nmodl/*.mod', "descriptions/templates/*/*"]}, |
|---|
| 51 | author = "The PyNN team", |
|---|
| 52 | author_email = "pynn@neuralensemble.org", |
|---|
| 53 | description = "A Python package for simulator-independent specification of neuronal network models", |
|---|
| 54 | long_description = """In other words, you can write the code for a model once, using the PyNN API and the Python programming language, and then run it without modification on any simulator that PyNN supports (currently NEURON, NEST, PCSIM and Brian). |
|---|
| 55 | |
|---|
| 56 | The API has two parts, a low-level, procedural API (functions ``create()``, ``connect()``, ``set()``, ``record()``, ``record_v()``), and a high-level, object-oriented API (classes ``Population`` and ``Projection``, which have methods like ``set()``, ``record()``, ``setWeights()``, etc.). |
|---|
| 57 | |
|---|
| 58 | The low-level API is good for small networks, and perhaps gives more flexibility. The high-level API is good for hiding the details and the book-keeping, allowing you to concentrate on the overall structure of your model. |
|---|
| 59 | |
|---|
| 60 | The other thing that is required to write a model once and run it on multiple simulators is standard cell and synapse models. PyNN translates standard cell-model names and parameter names into simulator-specific names, e.g. standard model ``IF_curr_alpha`` is ``iaf_neuron`` in NEST and ``StandardIF`` in NEURON, while ``SpikeSourcePoisson`` is a ``poisson_generator`` in NEST and a ``NetStim`` in NEURON. |
|---|
| 61 | |
|---|
| 62 | Even if you don't wish to run simulations on multiple simulators, you may benefit from writing your simulation code using PyNN's powerful, high-level interface. In this case, you can use any neuron or synapse model supported by your simulator, and are not restricted to the standard models. |
|---|
| 63 | |
|---|
| 64 | PyNN is a work in progress, but is already being used for several large-scale simulation projects.""", |
|---|
| 65 | license = "CeCILL http://www.cecill.info", |
|---|
| 66 | keywords = "computational neuroscience simulation neuron nest pcsim brian neuroml", |
|---|
| 67 | url = "http://neuralensemble.org/PyNN/", |
|---|
| 68 | classifiers = ['Development Status :: 4 - Beta', |
|---|
| 69 | 'Environment :: Console', |
|---|
| 70 | 'Intended Audience :: Science/Research', |
|---|
| 71 | 'License :: Other/Proprietary License', |
|---|
| 72 | 'Natural Language :: English', |
|---|
| 73 | 'Operating System :: OS Independent', |
|---|
| 74 | 'Programming Language :: Python', |
|---|
| 75 | 'Topic :: Scientific/Engineering'], |
|---|
| 76 | cmdclass = {'build': build}, |
|---|
| 77 | ) |
|---|
| 78 | |
|---|