diff --git a/.travis.python.sh b/.travis.python.sh index 9b5c4c664..5f551976d 100644 --- a/.travis.python.sh +++ b/.travis.python.sh @@ -1,6 +1,13 @@ #!/bin/bash set -x -e +if [ -z ${PYTHON_VERSION+x} ]; then + echo "Please provide the Python version to build against!" + exit 127 +fi + +PYTHON="python${PYTHON_VERSION}" + if [[ $(uname) == "Darwin" ]]; then brew install wget else @@ -10,7 +17,7 @@ fi CURRDIR=$(pwd) -sudo python -m pip install -r ./cython/requirements.txt +sudo $PYTHON -m pip install -r ./cython/requirements.txt mkdir $CURRDIR/build cd $CURRDIR/build @@ -21,7 +28,7 @@ cmake $CURRDIR -DCMAKE_BUILD_TYPE=Release \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ -DGTSAM_INSTALL_CYTHON_TOOLBOX=ON \ - -DGTSAM_PYTHON_VERSION=Default \ + -DGTSAM_PYTHON_VERSION=$PYTHON_VERSION \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=OFF \ -DCMAKE_INSTALL_PREFIX=$CURRDIR/../gtsam_install @@ -29,8 +36,8 @@ make -j$(nproc) install cd $CURRDIR/../gtsam_install/cython -sudo python setup.py install +sudo $PYTHON setup.py install cd $CURRDIR/cython/gtsam/tests -python -m unittest discover \ No newline at end of file +$PYTHON -m unittest discover \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 0afe7a43e..fe9667330 100644 --- a/.travis.yml +++ b/.travis.yml @@ -125,8 +125,10 @@ jobs: - stage: special os: linux compiler: gcc + env: PYTHON_VERSION=3 script: bash .travis.python.sh - stage: special os: osx compiler: clang + env: PYTHON_VERSION=3 script: bash .travis.python.sh