<commit_before>#!/bin/bash

set -x

WORKSPACE="${WORKSPACE:-$(pwd)}"
CLEAN_VIRTUALENV="${CLEAN_VIRTUALENV:-0}"
DJANGO_TAGGIT="${DJANGO_TAGGIT:-1}"
DJANGO_GENERIC_M2M="${DJANGO_GENERIC_M2M:-1}"
PYTHON_VERSION="${PYTHON_VERSION:-3.3}"
DJANGO_VERSION="${DJANGO_VERSION:-1.5}"
JOB_UNIQUE_ID="$PYTHON_VERSION-$DJANGO_VERSION-$DJANGO_TAGGIT-$DJANGO_GENERIC_M2M"
DATABASE_NAME="autocomplete_light_test_${JOB_UNIQUE_ID//[.-]}"

# Make a unique env path for this configuration
ENV_PATH="$WORKSPACE/test_env"

psql -c "drop database if exists $DATABASE_NAME;" -U postgres
psql -c "create database $DATABASE_NAME;" -U postgres

# Get real django version
[ ! -d "$HOME/django" ] && git clone http://github.com/django/django.git $HOME/.django
cd $HOME/.django
git fetch --tags
DJANGO_VERSION=$(git tag -l | grep -E "$DJANGO_VERSION(\.[0-9])?$" | tail -n1)

# Clean virtualenv if necessary
[ "$CLEAN_VIRTUALENV" = "1" ] && rm -rf $ENV_PATH

# Make virtualenv if necessary
[ ! -d "$ENV_PATH" ] && virtualenv-$PYTHON_VERSION $ENV_PATH

source $ENV_PATH/bin/activate

if [ "$DJANGO_TAGGIT" = "1" ]; then
    pip install -U django-taggit
else
    pip uninstall -y django-taggit
fi

if [ "$DJANGO_GENERIC_M2M" = "1" ]; then
    pip install -U django-generic-m2m
else
    pip uninstall -y django-generic-m2m
fi

pip install -e .
pip install -Ur $WORKSPACE/test_project/requirements.txt
pip install -Ur $WORKSPACE/test_project/test_requirements.txt

# Install appropriate django version because other package upgrades like
# pip install -U django-jenkins has caused installation of the latest django 
# release because it requires django>=1.4.<commit_msg>Don't assume to be in workspace<commit_after>#!/bin/bash

set -x

WORKSPACE="${WORKSPACE:-$(pwd)}"
CLEAN_VIRTUALENV="${CLEAN_VIRTUALENV:-0}"
DJANGO_TAGGIT="${DJANGO_TAGGIT:-1}"
DJANGO_GENERIC_M2M="${DJANGO_GENERIC_M2M:-1}"
PYTHON_VERSION="${PYTHON_VERSION:-3.3}"
DJANGO_VERSION="${DJANGO_VERSION:-1.5}"
JOB_UNIQUE_ID="$PYTHON_VERSION-$DJANGO_VERSION-$DJANGO_TAGGIT-$DJANGO_GENERIC_M2M"
DATABASE_NAME="autocomplete_light_test_${JOB_UNIQUE_ID//[.-]}"

# Make a unique env path for this configuration
ENV_PATH="$WORKSPACE/test_env"

psql -c "drop database if exists $DATABASE_NAME;" -U postgres
psql -c "create database $DATABASE_NAME;" -U postgres

# Get real django version
[ ! -d "$HOME/django" ] && git clone http://github.com/django/django.git $HOME/.django
cd $HOME/.django
git fetch --tags
DJANGO_VERSION=$(git tag -l | grep -E "$DJANGO_VERSION(\.[0-9])?$" | tail -n1)

# Clean virtualenv if necessary
[ "$CLEAN_VIRTUALENV" = "1" ] && rm -rf $ENV_PATH

# Make virtualenv if necessary
[ ! -d "$ENV_PATH" ] && virtualenv-$PYTHON_VERSION $ENV_PATH

source $ENV_PATH/bin/activate

if [ "$DJANGO_TAGGIT" = "1" ]; then
    pip install -U django-taggit
else
    pip uninstall -y django-taggit
fi

if [ "$DJANGO_GENERIC_M2M" = "1" ]; then
    pip install -U django-generic-m2m
else
    pip uninstall -y django-generic-m2m
fi

pip install -e $WORKSPACE
pip install -Ur $WORKSPACE/test_project/requirements.txt
pip install -Ur $WORKSPACE/test_project/test_requirements.txt

# Install appropriate django version because other package upgrades like
# pip install -U django-jenkins has caused installation of the latest django 
# release because it requires django>=1.4.
{'fraction_non_alphanumeric': 0.13748103186646435, 'fraction_numerical': 0.012746585735963581, 'mean_word_length': 5.047706422018349, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1472421', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1220, 'n_words': 289}