<commit_before>#!/bin/bash

# Path to the virtualenv executable
VENV=/usr/bin/virtualenv
SCRATCH_DIR=/tmp/$USER
ENVDIR_NAME=metricsenv
ENVDIR=$SCRATCH_DIR/$ENVDIR_NAME

mkdir metrics

pushd metrics
for x in api frontend backend aggregator; do
    # if the subdirectory does not exist, git clone it.
    if [ ! -d $x ] ; then
        git clone <EMAIL>:metrics/$x.git
    fi
done
popd

# if the env directory does not exist, virtualenv it.
if [ ! -d $ENVDIR ] ; then
    $VENV $ENVDIR
fi

# Setup symlinks to the virtualenv directory.
echo "Setting up symlinks"
for x in api frontend backend aggregator; do
    pushd metrics/$x
    ln -s $ENVDIR env
    popd
done

echo "Enabling virtualenv"
source $ENVDIR/bin/activate || echo "Unable to enable virtualenv." || exit 1

echo "Setting up."
# Install pip, because the requirements files need this.
easy_install pip

echo "Installing api."
pushd metrics/api; python setup.py install; popd

echo "Installing frontend dependencies"
pushd metrics/frontend; pip install -r requirements.txt; popd

echo "Installing backend dependencies"
pushd metrics/backend
pip install -r requirements.txt
echo "Installing backend."
python setup.py install
popd
<commit_msg>now fails when virtualenv cant be set up<commit_after>#!/bin/bash

# Path to the virtualenv executable
VENV=/usr/bin/virtualenv
SCRATCH_DIR=/tmp/$USER
ENVDIR_NAME=metricsenv
ENVDIR=$SCRATCH_DIR/$ENVDIR_NAME

mkdir metrics

pushd metrics
for x in api frontend backend aggregator; do
    # if the subdirectory does not exist, git clone it.
    if [ ! -d $x ] ; then
        git clone <EMAIL>:metrics/$x.git
    fi
done
popd

# if the env directory does not exist, virtualenv it.
if [ ! -d $ENVDIR ] ; then
    $VENV $ENVDIR
fi

# Setup symlinks to the virtualenv directory.
echo "Setting up symlinks"
for x in api frontend backend aggregator; do
    pushd metrics/$x
    ln -s $ENVDIR env
    popd
done

echo "Enabling virtualenv"
source $ENVDIR/bin/activate || echo "Unable to enable virtualenv." && exit 1

echo "Setting up."
# Install pip, because the requirements files need this.
easy_install pip

echo "Installing api."
pushd metrics/api; python setup.py install; popd

echo "Installing frontend dependencies"
pushd metrics/frontend; pip install -r requirements.txt; popd

echo "Installing backend dependencies"
pushd metrics/backend
pip install -r requirements.txt
echo "Installing backend."
python setup.py install
popd

{'fraction_non_alphanumeric': 0.08082474226804123, 'fraction_numerical': 0.0008247422680412372, 'mean_word_length': 3.9917695473251027, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3047860', 'n_tokens_mistral': 767, 'n_tokens_neox': 766, 'n_words': 297}