From 32db889b43158e809e57059f68ba2533c240203c Mon Sep 17 00:00:00 2001 From: mckelvin Date: Sun, 5 Feb 2017 19:42:26 +0800 Subject: [PATCH] Update .travis.yml --- .travis.yml | 22 ++++++++++++++-------- Makefile | 2 +- tools/build_talib_from_source.bash | 26 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100755 tools/build_talib_from_source.bash diff --git a/.travis.yml b/.travis.yml index 8550eb908..6695f589d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +--- language: python python: - "2.7" @@ -8,15 +9,20 @@ os: - linux env: global: - - TA_INCLUDE_PATH=$HOME/dependencies/include - - TA_LIBRARY_PATH=$HOME/dependencies/lib - - LD_LIBRARY_PATH=$HOME/dependencies/lib + - DEPS_DIR=$HOME/dependencies + matrix: + - WITH_TA_LIBRARY=yes + TA_INCLUDE_PATH=$DEPS_DIR/include + LD_LIBRARY_PATH=$DEPS_DIR/lib + TA_LIBRARY_PATH=$DEPS_DIR/lib +cache: + directories: + - $DEPS_DIR install: + - pip install --upgrade pip wheel - pip install -r requirements_test.txt - - mkdir $HOME/dependencies - - wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz - - tar -xvzf ta-lib-0.4.0-src.tar.gz - - pushd ta-lib && ./configure --prefix=$HOME/dependencies && make install && popd + - if [ $WITH_TA_LIBRARY = "yes" ]; then + ./tools/build_talib_from_source.bash $DEPS_DIR; + fi script: - - make - make test diff --git a/Makefile b/Makefile index c0897ad01..bfbe4d2fd 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ clean: perf: python tools/perf_talib.py -test: +test: build LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} nosetests sdist: diff --git a/tools/build_talib_from_source.bash b/tools/build_talib_from_source.bash new file mode 100755 index 000000000..84f9572e2 --- /dev/null +++ b/tools/build_talib_from_source.bash @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +if [[ -z $1 ]]; then + echo "Usage: $0 deps_dir" + exit 1 +fi + +DEPS_DIR=$1 + +TA_LIB_TGZ="ta-lib-0.4.0-src.tar.gz" +TA_LIB_URL="http://prdownloads.sourceforge.net/ta-lib/$TA_LIB_TGZ" + +if [[ -d $DEPS_DIR/lib ]]; then + echo "Already built" + exit 0 +fi +mkdir -p $DEPS_DIR/tmp +wget -O "$DEPS_DIR/tmp/$TA_LIB_TGZ" $TA_LIB_URL +pushd $DEPS_DIR/tmp +tar -zxvf $TA_LIB_TGZ +popd +pushd $DEPS_DIR/tmp/ta-lib +./configure --prefix=$DEPS_DIR +make install +popd