2016-05-20 14:16:01 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-05-24 05:47:00 +00:00
|
|
|
######################################################
|
|
|
|
# dev_setup.sh
|
|
|
|
# @author sean.fitzgerald (aka clusterfudge)
|
|
|
|
#
|
|
|
|
# The purpose of this script is to create a self-
|
|
|
|
# contained development environment using
|
|
|
|
# virtualenv for python dependency sandboxing.
|
|
|
|
# This script will create a virtualenv (using the
|
|
|
|
# conventions set by virtualenv-wrapper for
|
|
|
|
# location and naming) and install the requirements
|
|
|
|
# laid out in requirements.txt, pocketsphinx, and
|
|
|
|
# pygtk into the virtualenv. Mimic will be
|
|
|
|
# installed and built from source inside the local
|
|
|
|
# checkout.
|
|
|
|
#
|
|
|
|
# The goal of this script is to create a development
|
|
|
|
# environment in user space that is fully functional.
|
|
|
|
# It is expected (and even encouraged) for a developer
|
|
|
|
# to work on multiple projects concurrently, and a
|
|
|
|
# good OSS citizen respects that and does not pollute
|
|
|
|
# a developers workspace with it's own dependencies
|
|
|
|
# (as much as possible).
|
|
|
|
# </endRant>
|
|
|
|
######################################################
|
|
|
|
|
2016-05-20 14:16:01 +00:00
|
|
|
# exit on any error
|
|
|
|
set -Ee
|
|
|
|
|
2016-05-24 05:47:00 +00:00
|
|
|
if [ $(id -u) -eq 0 ]; then
|
|
|
|
echo "This script should not be run as root or with sudo."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-05-20 14:16:01 +00:00
|
|
|
TOP=$(cd $(dirname $0) && pwd -L)
|
|
|
|
VIRTUALENV_ROOT=${VIRTUALENV_ROOT:-"${HOME}/.virtualenvs/mycroft"}
|
|
|
|
|
|
|
|
# create virtualenv, consistent with virtualenv-wrapper conventions
|
|
|
|
if [ ! -d ${VIRTUALENV_ROOT} ]; then
|
|
|
|
mkdir -p $(dirname ${VIRTUALENV_ROOT})
|
|
|
|
virtualenv ${VIRTUALENV_ROOT}
|
|
|
|
fi
|
|
|
|
source ${VIRTUALENV_ROOT}/bin/activate
|
|
|
|
cd ${TOP}
|
|
|
|
easy_install pip==7.1.2 # force version of pip
|
|
|
|
|
|
|
|
# install requirements (except pocketsphinx)
|
|
|
|
pip install -r requirements.txt --trusted-host pypi.mycroft.team
|
|
|
|
|
|
|
|
# clone pocketsphinx-python at HEAD (fix to a constant version later)
|
|
|
|
if [ ! -d ${TOP}/pocketsphinx-python ]; then
|
|
|
|
# build sphinxbase and pocketsphinx if we haven't already
|
|
|
|
git clone --recursive https://github.com/cmusphinx/pocketsphinx-python
|
|
|
|
cd ${TOP}/pocketsphinx-python/sphinxbase
|
|
|
|
./autogen.sh
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
cd ${TOP}/pocketsphinx-python/pocketsphinx
|
|
|
|
./autogen.sh
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
fi
|
|
|
|
|
|
|
|
# build and install pocketsphinx python bindings
|
|
|
|
cd ${TOP}/pocketsphinx-python
|
|
|
|
python setup.py install
|
|
|
|
|
|
|
|
#build and install mimic
|
2016-05-21 14:57:07 +00:00
|
|
|
cd ${TOP}
|
|
|
|
${TOP}/install-mimic.sh
|
2016-05-20 14:16:01 +00:00
|
|
|
|
|
|
|
# install pygtk for desktop_launcher skill
|
|
|
|
${TOP}/install-pygtk.sh
|