2017-03-24 14:43:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# The purpose of this file is to install the requirements for the docsite
|
|
|
|
# You can call it manually if running make manually, otherwise gradle will run it for you
|
|
|
|
|
|
|
|
set -xeo pipefail
|
|
|
|
|
2017-03-24 16:23:12 +00:00
|
|
|
# Install the virtualenv
|
2017-03-24 14:43:45 +00:00
|
|
|
if [ ! -d "virtualenv" ]
|
|
|
|
then
|
2017-08-18 12:31:00 +00:00
|
|
|
# If the canonical working directory contains whitespace, virtualenv installs broken scripts.
|
|
|
|
# But if we pass in an absolute path that uses symlinks to avoid whitespace, that fixes the problem.
|
|
|
|
# If you run this script manually (not via gradle) from such a path alias, it's available in PWD:
|
|
|
|
absolutevirtualenv="$PWD/virtualenv"
|
2017-03-24 14:43:45 +00:00
|
|
|
# Check if python2.7 is installed explicitly otherwise fall back to the default python
|
|
|
|
if type "python2.7" > /dev/null; then
|
2017-08-18 12:31:00 +00:00
|
|
|
virtualenv -p python2.7 "$absolutevirtualenv"
|
2017-03-24 14:43:45 +00:00
|
|
|
else
|
2017-08-18 12:31:00 +00:00
|
|
|
virtualenv "$absolutevirtualenv"
|
2017-03-24 14:43:45 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-03-24 16:23:12 +00:00
|
|
|
# Activate the virtualenv
|
2017-03-24 14:43:45 +00:00
|
|
|
if [ -d "virtualenv/bin" ]
|
|
|
|
then
|
|
|
|
# it's a Unix system
|
2017-03-24 16:23:12 +00:00
|
|
|
source virtualenv/bin/activate
|
2017-03-24 14:43:45 +00:00
|
|
|
else
|
2017-03-24 16:23:12 +00:00
|
|
|
source virtualenv/Scripts/activate
|
2017-03-24 14:43:45 +00:00
|
|
|
fi
|
|
|
|
|
2017-03-24 16:23:12 +00:00
|
|
|
# Install PIP requirements
|
2017-03-24 14:43:45 +00:00
|
|
|
if [ ! -d "virtualenv/lib/python2.7/site-packages/sphinx" ]
|
|
|
|
then
|
|
|
|
echo "Installing pip dependencies ... "
|
|
|
|
pip install -r requirements.txt
|
2017-08-18 12:31:00 +00:00
|
|
|
fi
|