<commit_before>#!/bin/bash

SCRIPT_DIR=$(dirname $0)
source ${SCRIPT_DIR}/config

THIRDPARTY_DIR=${SCRIPT_DIR}/../thirdparty

function confirm_install_prerequisites() {
  local -A prerequisites=(
    ["gcc"]="gcc"
    ["pip"]="python-pip"
    ["tar"]="tar"
    ["unzip"]="unzip"
  )
  which apt-get &> /dev/null
  if [ $? -ne 0 ]; then
    echo "Cannot find 'apt-get' (APT package manager)."
    echo "Possibly you are not using Debian-originated Linux?"
    echo "TODO: Support non-Debian Linux distributions."
    exit 1
  fi
  for command in ${!prerequisites[@]}
  do
    which ${command} &> /dev/null
    if [ $? -ne 0 ]; then
      echo "Cannot find '${command}'."
      echo "Possibly you can install it by 'sudo apt-get install" \
        "${prerequisites[${command}]}'."
      exit 1
    fi
  done
}

function create_install_directory() {
  echo "Creating INSTALL_DIR: ${INSTALL_DIR}"
  mkdir -p ${INSTALL_DIR}
  if [ $? -ne 0 ]; then
    echo "Failed to create the install path: ${INSTALL_DIR}"
    exit 1
  fi
}

function install_kancolle_player_prerequisites() {
  local kancolle_player_prerequisites=(
    flashplugin-installer
    otf-ipafont-gothic
    xorg
  )
  echo "Installing Kancolle player prerequisites..."
  sudo apt-get install ${kancolle_player_prerequisites[@]}
}

# Python third-party packages required to run the KCAA Python server.
function install_python_server_prerequisites() {
  local python_server_apt_prerequisites=(
    openjdk-7-jre
    python-dev
    zlib1g-dev
  )
  echo "Installing KCAA Python server APT prerequisites..."
  sudo apt-get install ${python_server_apt_prerequisites[@]}
  local python_server_prerequisites=(
    pillow
    python-dateutil
    requests
    selenium
  )
  echo "Installing KCAA Python server prerequisites..."
  for package in ${python_server_prerequisites[@]}
  do
    sudo pip install ${package}
  done
}

# Python packages required to test the KCAA Python server code.
function install_python_server_testing_prerequisites() {
  local python_server_prerequisites=(<commit_msg>Add JPEG library as a dependency.<commit_after>#!/bin/bash

SCRIPT_DIR=$(dirname $0)
source ${SCRIPT_DIR}/config

THIRDPARTY_DIR=${SCRIPT_DIR}/../thirdparty

function confirm_install_prerequisites() {
  local -A prerequisites=(
    ["gcc"]="gcc"
    ["pip"]="python-pip"
    ["tar"]="tar"
    ["unzip"]="unzip"
  )
  which apt-get &> /dev/null
  if [ $? -ne 0 ]; then
    echo "Cannot find 'apt-get' (APT package manager)."
    echo "Possibly you are not using Debian-originated Linux?"
    echo "TODO: Support non-Debian Linux distributions."
    exit 1
  fi
  for command in ${!prerequisites[@]}
  do
    which ${command} &> /dev/null
    if [ $? -ne 0 ]; then
      echo "Cannot find '${command}'."
      echo "Possibly you can install it by 'sudo apt-get install" \
        "${prerequisites[${command}]}'."
      exit 1
    fi
  done
}

function create_install_directory() {
  echo "Creating INSTALL_DIR: ${INSTALL_DIR}"
  mkdir -p ${INSTALL_DIR}
  if [ $? -ne 0 ]; then
    echo "Failed to create the install path: ${INSTALL_DIR}"
    exit 1
  fi
}

function install_kancolle_player_prerequisites() {
  local kancolle_player_prerequisites=(
    flashplugin-installer
    otf-ipafont-gothic
    xorg
  )
  echo "Installing Kancolle player prerequisites..."
  sudo apt-get install ${kancolle_player_prerequisites[@]}
}

# Python third-party packages required to run the KCAA Python server.
function install_python_server_prerequisites() {
  local python_server_apt_prerequisites=(
    libjpeg8-dev
    openjdk-7-jre
    python-dev
    zlib1g-dev
  )
  echo "Installing KCAA Python server APT prerequisites..."
  sudo apt-get install ${python_server_apt_prerequisites[@]}
  local python_server_prerequisites=(
    pillow
    python-dateutil
    requests
    selenium
  )
  echo "Installing KCAA Python server prerequisites..."
  for package in ${python_server_prerequisites[@]}
  do
    sudo pip install ${package}
  done
}

# Python packages required to test the KCAA Python server code.
function install_python_server_testing_prerequisites() {
  local python_server_prerequisites=(
{'fraction_non_alphanumeric': 0.11323493830147592, 'fraction_numerical': 0.004597144931042826, 'mean_word_length': 3.6397306397306397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '1826531', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1345, 'n_words': 371}