Created
May 6, 2015 15:05
-
-
Save tarelli/6d23d9fa33eca5b6d253 to your computer and use it in GitHub Desktop.
Setup NEURON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from subprocess import check_output as co | |
from distutils.core import run_setup | |
class working_dir(object): | |
"""Context manager for changing the current working directory""" | |
def __init__(self, newPath): | |
self.newPath = newPath | |
def __enter__(self): | |
self.savedPath = os.getcwd() | |
os.chdir(self.newPath) | |
def __exit__(self, etype, value, traceback): | |
os.chdir(self.savedPath) | |
nrnpath = '/home/virgo/neuron' | |
os.mkdir(nrnpath) | |
with working_dir(nrnpath): | |
print co(['wget', 'http://www.neuron.yale.edu/ftp/neuron/versions/v7.3/nrn-7.3.tar.gz']) | |
print co(['tar', 'xzvf', 'nrn-7.3.tar.gz']) | |
print co(['mv', 'nrn-7.3', 'nrn']) | |
os.chdir('nrn') | |
path = os.getcwd() | |
pyexec = sys.executable | |
co(["./configure --prefix=%s --without-iv --with-nrnpython=%s"%(path,pyexec)], shell=True) | |
print co(['make']) | |
print co(['make', 'install']) | |
os.chdir('src/nrnpython') | |
run_setup('./setup.py', ['install']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment