diff --git a/.travis.yml b/.travis.yml index 66da4f50371..4d147685837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ env: - GIT_CI_USER: TravisCI - GIT_CI_EMAIL: TravisCI@mdanalysis.org - MDA_DOCDIR: package/doc/html + - MDA_OPTPACKAGES: opt/packages matrix: - SETUP=minimal PYTHON_VERSION=2.7 - SETUP=full PYTHON_VERSION=2.7 @@ -45,6 +46,16 @@ install: - pip install testsuite/ - pip install coveralls - chmod +x testsuite/MDAnalysisTests/mda_nosetests +# additional external tools (Isssue #898) -- HOLE + - | + if [[ $SETUP == 'full' ]]; then \ + bash ./maintainer/install_hole.sh $TRAVIS_OS_NAME "${HOME}/${MDA_OPTPACKAGES}"; \ + HOLE_BINDIR="${HOME}/${MDA_OPTPACKAGES}/hole2/exe"; \ + export PATH=${PATH}:${HOLE_BINDIR}; \ + fi + # we should still be here but make doubly sure: + - cd ${TRAVIS_BUILD_DIR} + # command to run tests script: - ./testsuite/MDAnalysisTests/mda_nosetests --with-coverage --cover-package MDAnalysis --processes=2 --process-timeout=300 --with-memleak diff --git a/maintainer/install_hole.sh b/maintainer/install_hole.sh new file mode 100755 index 00000000000..1f55e93d6e9 --- /dev/null +++ b/maintainer/install_hole.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# Install HOLE from http://www.smartsci.uk/hole/ +# +# arguments +# OSNAME : linux | darwin +# PREFIX : "path/to/installdir" +# +# PREFIX can be relative to HOME or an absolute path; it will be created +# and HOLE unpacked under PREFIX (the tar file contains "hole2/...") + +set -o errexit -o nounset + +SCRIPT=$(basename $0) + +DOWNLOAD_URL_LINUX='https://www.dropbox.com/s/jukpwlohhi20r17/hole2-NotForProfit-2.2.004-Linux-x86_64.tar.gz?dl=1' +TARFILE_LINUX='hole2-NotForProfit-2.2.004-Linux-x86_64.tar.gz' + +DOWNLOAD_URL_DARWIN='https://www.dropbox.com/s/5mzrsyp48i32je4/hole2-NotForProfit-2.2.004-Darwin-i386.tar.gz?dl=1' +TARFILE_DARWIN=hole2-NotForProfit-2.2.004-Darwin-i386.tar.gz + +# path to dir with executables in the current HOLE distribution +HOLE_EXE_DIR=hole2/exe + +function die () { + local msg="$1" err=$2 + echo "[${SCRIPT}] ERROR: $msg [$err]" + exit $err +} + +function is_native_executable () { + local filename="$1" OSNAME="$2" + file "${filename}" | grep -qi ${OFORMAT} + return $? +} + +OSNAME="$1" +case "$OSNAME" in + Linux|linux) + OSNAME=Linux + OFORMAT=Linux + DOWNLOAD_URL="${DOWNLOAD_URL_LINUX}" + TARFILE=${TARFILE_LINUX} + ;; + OSX|osx|Darwin|darwin) + OSNAME=Darwin + OFORMAT="Mach-O" + DOWNLOAD_URL="${DOWNLOAD_URL_DARWIN}" + TARFILE=${TARFILE_DARWIN} + ;; + *) + die "OS '${OSNAME}' not supported." 10;; +esac + +PREFIX="$2" +test -n "$PREFIX" || die "missing second argument PREFIX (installation directory)" 10 + +#------------------------------------------------------------ +# start installation +#------------------------------------------------------------ + +cd ~ +mkdir -p "$PREFIX" && cd "$PREFIX" || die "Failed to create and cd to $PREFIX" 1 +test -f ${TARFILE} || \ + curl -L ${DOWNLOAD_URL} -o ${TARFILE} || \ + die "Failed to download ${TARFILE} from ${DOWNLOAD_URL}" 1 + +# only install the executables in HOLE_EXE_DIR +tar xvf ${TARFILE} ${HOLE_EXE_DIR} || die "Failed 'tar xvf ${TARFILE} ${HOLE_EXE_DIR}'" 1 + +MDA_HOLE_BINDIR="${PWD}/${HOLE_EXE_DIR}" +HOLE_EXE="${MDA_HOLE_BINDIR}/hole" + +test -d "${MDA_HOLE_BINDIR}" || { \ + echo "Content of ${PWD}:"; + ls -la; + die "no HOLE exe dir ${MDA_HOLE_BINDIR} in $PWD" 2; } +test -f "${HOLE_EXE}" || die "hole executable ${HOLE_EXE} not installed" 2 +is_native_executable ${HOLE_EXE} ${OFORMAT} || \ + { file ${HOLE_EXE}; \ + die "${HOLE_EXE} will not run on ${OSNAME} (object format ${OFORMAT})" 3; } + +echo "HOLE executables were installed into ${MDA_HOLE_BINDIR}" +echo ">>> export PATH=\${PATH}:${MDA_HOLE_BINDIR}" + +# repeat this line in .travis.yml +export PATH=${PATH}:${MDA_HOLE_BINDIR}