<commit_before>#!/bin/bash

PREFIX=/usr/local
GMP_VER=5.1.2
PYTHON_VER=2.7.5
PYCRYPTO_VER=2.6

# install gmp
# pycrypto 2.6 needs gmp >= 5.0, however gmp rpm version is 4.3.1.
# So we need to install gmp from source.
install_gmp() {
  if [ ! -f /etc/ld.so.conf.d/libgmp.so.10.conf ]; then
    yum install -y curl tar xz gcc make m4
    curl ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.xz -o $PREFIX/src/gmp-$GMP_VER.tar.xz
    tar xf $PREFIX/src/gmp-$GMP_VER.tar.xz -C $PREFIX/src
    cd $PREFIX/src/gmp-$GMP_VER
    ./configure
    make
    make install
    echo $PREFIX/lib > /etc/ld.so.conf.d/libgmp.so.10.conf
    ldconfig
  fi
}

install_python() {
  if [ ! -f $PREFIX/python-$PYTHON_VER/bin/python ]; then
    yum install -y \
      git \
      gcc \
      tar \
      make \
      bzip2-devel \
      readline-devel \
      openssl-devel \
      sqlite-devel
    cd $PREFIX/src
    git clone git://github.com/tagomoris/xbuild.git
    $PREFIX/src/xbuild/python-install $PYTHON_VER $PREFIX/python-$PYTHON_VER
  fi

  if ! grep -q "export PATH=$PREFIX/python-$PYTHON_VER/bin:\$PATH" \
      ~/.bash_profile; then
    echo "export PATH=$PREFIX/python-$PYTHON_VER/bin:\$PATH" >> ~/.bash_profile
  fi
}

install_pycrypto() {
  if [ ! -f $PREFIX/src/pycrypto-$PYCRYPTO_VER.tar.gz ]; then
    curl https://pypi.python.org/packages/source/p/pycrypto/pycrypto-$PYCRYPTO_VER.tar.gz -o $PREFIX/src/pycrypto-$PYCRYPTO_VER.tar.gz
  fi
  if [ ! -d $PREFIX/src/pycrypto-$PYCRYPTO_VER ]; then
    tar xf $PREFIX/src/pycrypto-$PYCRYPTO_VER.tar.gz -C $PREFIX/src
  fi
  if [ -z "`pip show pycrypto`" ]; then
    cd $PREFIX/src/pycrypto-$PYCRYPTO_VER
    python setup.py install --prefix=$PREFIX/python-$PYTHON_VER
  fi
}

install_fabric() {
  if [ -z "`pip show fabric`" ]; then
    pip install fabric
  fi
  if [ -z "`pip show fabtools`" ]; then
    pip install fabtools
  fi
}


install_gmp
install_python
export PATH=$PREFIX/python-$PYTHON_VER/bin:$PATH
install_pycrypto
install_fabric
<commit_msg>Install jinja2 with pip.<commit_after>#!/bin/bash

PREFIX=/usr/local
GMP_VER=5.1.2
PYTHON_VER=2.7.5
PYCRYPTO_VER=2.6

# install gmp
# pycrypto 2.6 needs gmp >= 5.0, however gmp rpm version is 4.3.1.
# So we need to install gmp from source.
install_gmp() {
  if [ ! -f /etc/ld.so.conf.d/libgmp.so.10.conf ]; then
    yum install -y curl tar xz gcc make m4
    curl ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.xz -o $PREFIX/src/gmp-$GMP_VER.tar.xz
    tar xf $PREFIX/src/gmp-$GMP_VER.tar.xz -C $PREFIX/src
    cd $PREFIX/src/gmp-$GMP_VER
    ./configure
    make
    make install
    echo $PREFIX/lib > /etc/ld.so.conf.d/libgmp.so.10.conf
    ldconfig
  fi
}

install_python() {
  if [ ! -f $PREFIX/python-$PYTHON_VER/bin/python ]; then
    yum install -y \
      git \
      gcc \
      tar \
      make \
      bzip2-devel \
      readline-devel \
      openssl-devel \
      sqlite-devel
    cd $PREFIX/src
    git clone git://github.com/tagomoris/xbuild.git
    $PREFIX/src/xbuild/python-install $PYTHON_VER $PREFIX/python-$PYTHON_VER
  fi

  if ! grep -q "export PATH=$PREFIX/python-$PYTHON_VER/bin:\$PATH" \
      ~/.bash_profile; then
    echo "export PATH=$PREFIX/python-$PYTHON_VER/bin:\$PATH" >> ~/.bash_profile
  fi
}

install_pycrypto() {
  if [ ! -f $PREFIX/src/pycrypto-$PYCRYPTO_VER.tar.gz ]; then
    curl https://pypi.python.org/packages/source/p/pycrypto/pycrypto-$PYCRYPTO_VER.tar.gz -o $PREFIX/src/pycrypto-$PYCRYPTO_VER.tar.gz
  fi
  if [ ! -d $PREFIX/src/pycrypto-$PYCRYPTO_VER ]; then
    tar xf $PREFIX/src/pycrypto-$PYCRYPTO_VER.tar.gz -C $PREFIX/src
  fi
  if [ -z "`pip show pycrypto`" ]; then
    cd $PREFIX/src/pycrypto-$PYCRYPTO_VER
    python setup.py install --prefix=$PREFIX/python-$PYTHON_VER
  fi
}

install_fabric() {
  if [ -z "`pip show fabric`" ]; then
    pip install fabric
  fi
  if [ -z "`pip show fabtools`" ]; then
    pip install fabtools
  fi
  if [ -z "`pip show jinja2`" ]; then
    pip install jinja2
  fi
}


install_gmp
install_python
export PATH=$PREFIX/python-$PYTHON_VER/bin:$PATH
install_pycrypto
install_fabric

{'fraction_non_alphanumeric': 0.14335060449050085, 'fraction_numerical': 0.011102886750555145, 'mean_word_length': 2.7261029411764706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5647903', 'n_tokens_mistral': 1693, 'n_tokens_neox': 1585, 'n_words': 327}