<commit_before>#!/bin/bash

set -e  # stop execution in case of errors

if [ -z "$1" ]; then
    echo "Please provide Neuron version to install script"
    exit
fi

NEURON_VERSION=$1
NEURON=nrn-$NEURON_VERSION

if [ -z "$2" ]; then
    # Use virtualenv bin by default
    export NEURON_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)");
    if [ $NEURON_INSTALL_PREFIX == '/usr' ] || [ $NEURON_INSTALL_PREFIX == '/usr/local' ]; then
        export NEURON_INSTALL_PREFIX=$HOME/neuron
    fi
else
    export NEURON_INSTALL_PREFIX=$2
fi
echo "Installing Neuron to '$NEURON_BUILD_DIR'"

if [ -z "$3" ]; then
    export NEURON_BUILD_DIR=$HOME/pype9-build/neuron
    rm -rf $NEURON_BUILD_DIR
else
    export NEURON_BUILD_DIR=$3
fi
echo "Using '$NEURON_BUILD_DIR' as NEURON build directory"
mkdir -p $NEURON_BUILD_DIR

SRC_DIR=$NEURON_BUILD_DIR/$NEURON
BUILD_DIR=$NEURON_BUILD_DIR/$NEURON-build

# Download and untar
wget http://www.neuron.yale.edu/ftp/neuron/versions/v$NEURON_VERSION/$NEURON.tar.gz -O $NEURON_BUILD_DIR/$NEURON.tar.gz;
pushd $NEURON_BUILD_DIR;
tar xzf $NEURON.tar.gz;
popd;

mkdir -p $NEURON_BUILD_DIR
pushd $NEURON_BUILD_DIR

# Configure, make and install
echo "Install Prefix: $NEURON_INSTALL_PREFIX"
$SRC_DIR/configure --with-paranrn --with-nrnpython \
 --prefix=$NEURON_INSTALL_PREFIX --disable-rx3d --without-iv;
make -j8;
make install

# Install Python
cd src/nrnpython
python setup.py install
pip install nrnutils  # must be installed after NEURON

# Create links to required NEURON utilities
cd $NEURON_INSTALL_PREFIX/bin;
ls -l;
ln -sf ../x86_64/bin/nrnivmodl;
ln -sf ../x86_64/bin/modlunit;
popd
<commit_msg>added ability to install specific commit from github<commit_after>#!/bin/bash

set -e  # stop execution in case of errors

if [ -z "$1" ]; then
    echo "Please provide Neuron version to install script"
    exit
fi

NEURON_VERSION=$1
NEURON=nrn-$NEURON_VERSION

if [ -z "$2" ]; then
    # Use virtualenv bin by default
    export NEURON_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)");
    if [ $NEURON_INSTALL_PREFIX == '/usr' ] || [ $NEURON_INSTALL_PREFIX == '/usr/local' ]; then
        export NEURON_INSTALL_PREFIX=$HOME/neuron
    fi
else
    export NEURON_INSTALL_PREFIX=$2
fi
echo "Installing Neuron to '$NEURON_BUILD_DIR'"

if [ -z "$3" ]; then
    export NEURON_BUILD_DIR=$HOME/pype9-build/neuron
    rm -rf $NEURON_BUILD_DIR
else
    export NEURON_BUILD_DIR=$3
fi
echo "Using '$NEURON_BUILD_DIR' as NEURON build directory"
mkdir -p $NEURON_BUILD_DIR

SRC_DIR=$NEURON_BUILD_DIR/$NEURON
BUILD_DIR=$NEURON_BUILD_DIR/$NEURON-build

if [ "${NEURON_VERSION%%-*}" == 'sha' ]; then
    # Download and untar
    wget http://github.com/nrnhines/nrn/archive/{$NEURON_VERSION##sha-}.zip -O $NEURON_BUILD_DIR/$NEURON.zip;
    pushd $NEURON_BUILD_DIR;
    unzip $NEURON.zip;
    rm $NEURON.zip;
    mv nrn* $NEURON;
    pushd $NEURON;
    ./build.sh;  # run libtoolize
    popd;
    popd;
else
    # Download and untar
    wget http://www.neuron.yale.edu/ftp/neuron/versions/v$NEURON_VERSION/$NEURON.tar.gz -O $NEURON_BUILD_DIR/$NEURON.tar.gz;
    pushd $NEURON_BUILD_DIR;
    tar xzf $NEURON.tar.gz;
    popd;
fi

mkdir -p $NEURON_BUILD_DIR
pushd $NEURON_BUILD_DIR

# Configure, make and install
echo "Install Prefix: $NEURON_INSTALL_PREFIX"
$SRC_DIR/configure --with-paranrn --with-nrnpython \
 --prefix=$NEURON_INSTALL_PREFIX --disable-rx3d --without-iv;
make -j8;
make install

# Install Python
cd src/nrnpython
python setup.py install
pip install nrnutils  # must be installed after NEURON

# Create links to required NEURON utilities
cd $NEURON_INSTALL_PREFIX/bin;
ls -l;
ln -sf ../x86_64/bin/nrnivmodl;
ln -sf ../x86_64/bin/modlunit;
popd

{'fraction_non_alphanumeric': 0.11857065511640498, 'fraction_numerical': 0.009204114780725501, 'mean_word_length': 4.0272108843537415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7174603', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1423, 'n_words': 338}