#!/bin/bash
set -e
cd `dirname $0`
export PIP_DOWNLOAD_CACHE=`pwd`/../pip_cache
cat ../openmedialibrary/requirements.txt \
    | grep -v lxml \
    | grep -v pyopenssl \
    | grep -v pyCrypto \
    | grep -v pillow \
    | grep -v simplejson \
    > requirements.txt
echo setuptools >> requirements.txt
echo six >> requirements.txt
mkdir old
test -e lib && mv lib old/
test -e bin && mv bin old/

rm -rf p35

virtualenv -p /usr/bin/python3.5 p35
p35/bin/pip3 install -r requirements.txt
mkdir -p lib/python3.5
mv p35/lib/python3.5/site-packages lib/python3.5/site-packages

rm -r p35 old requirements.txt
