diff --git a/.travis.yml b/.travis.yml index edc338ad7044d687121fad794b1708b1207b26f3..980135067791b472bb2f28208c88742b6be14746 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ -language: generic +language: python python: - "2.7" + - "3.4" sudo: required dist: trusty compiler: @@ -9,7 +10,7 @@ compiler: env: global: - secure: "SnIBG/xLIHX3CSvUbqqsX8xTVqIqQ7fFS6HWO6KZQVBsT6yugTwYHbyhNiU531JejYJ/I3ZrDhXfYH3qFZiYxnH1sifvwV+fnTtMXpPN7qPZwIymkjcmm6gJF51e0C7VOfUbvKFv0ngwj+ul21rgZSMuoEvxPK0WxtE3/ZSfn9c=" - - APT_DEPENDENCIES="doxygen libeigen3-dev " + - APT_DEPENDENCIES="doxygen libeigen3-dev libboost-test-dev libboost-python-dev libeigen3-dev" - DEBSIGN_KEYID=5AE5CD75 - CC=gcc - DO_COVERAGE_ON_BRANCH="master;release" @@ -19,24 +20,18 @@ env: - BUILDTYPE=Release - BUILDTYPE=Debug notifications: -email: - - pinocchio@laas.fr + email: + - pinocchio-build@laas.fr branches: -only: - - master - - debian - - devel -matrix: -allow_failures: - - compiler: -before_install: ./travis_custom/custom_before_install -install: - - pip install --user coveralls - - pip install --user numpy + only: + - master + - debian + - devel +before_install: ./.travis/run before_install +install: pip install coveralls numpy script: - export CMAKE_ADDITIONAL_OPTIONS="-DCMAKE_BUILD_TYPE=${BUILDTYPE}" - sudo free -m -t - ./.travis/run ../travis_custom/custom_build after_failure: ./.travis/run after_failure -after_success: - - ./.travis/run after_success +after_success: ./.travis/run after_success diff --git a/travis_custom/custom_before_install b/travis_custom/custom_before_install deleted file mode 100755 index 46e3546485f36a313bad37f4a910b03098dba3c8..0000000000000000000000000000000000000000 --- a/travis_custom/custom_before_install +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -# Setup environment variables. -export APT_DEPENDENCIES="doxygen libboost-test-dev libboost-python-dev libeigen3-dev python2.7-dev python-numpy" - -# When this script is called the current directory is ./custom_travis -. ./.travis/run ../.travis/before_install diff --git a/unittest/python/test_eigenpy.py b/unittest/python/test_eigenpy.py index aab786f7e518e2b3cc7742751d03a64525a60394..2e63b1ca39e5f1e2c828e9ddbd4bf5a7e4b6da64 100644 --- a/unittest/python/test_eigenpy.py +++ b/unittest/python/test_eigenpy.py @@ -1,101 +1,103 @@ +from __future__ import print_function + import numpy as np import matrix as eigenpy verbose = False -if verbose: print "===> From MatrixXd to Py" +if verbose: print("===> From MatrixXd to Py") M = eigenpy.naturals(3,3,verbose) Mcheck = np.reshape(np.matrix(range(9),np.double),[3,3]) assert np.array_equal(Mcheck,M) -if verbose: print "===> From Matrix3d to Py" +if verbose: print("===> From Matrix3d to Py") M33= eigenpy.naturals33(verbose) assert np.array_equal(Mcheck,M33) -if verbose: print "===> From VectorXd to Py" +if verbose: print("===> From VectorXd to Py") v = eigenpy.naturalsX(3,verbose) vcheck = np.matrix([range(3),],np.double).T assert np.array_equal(vcheck ,v) -if verbose: print "===> From Py to Eigen::MatrixXd" -if verbose: print "===> From Py to Eigen::MatrixXd" -if verbose: print "===> From Py to Eigen::MatrixXd" +if verbose: print("===> From Py to Eigen::MatrixXd") +if verbose: print("===> From Py to Eigen::MatrixXd") +if verbose: print("===> From Py to Eigen::MatrixXd") Mref = np.reshape(np.matrix(range(64),np.double),[8,8]) -if verbose: print "===> Matrix 8x8" +if verbose: print("===> Matrix 8x8") M = Mref assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block 0:3x0:3" +if verbose: print("===> Block 0:3x0:3") M = Mref[0:3,0:3] assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block 1:3x1:3" +if verbose: print("===> Block 1:3x1:3") M = Mref[1:3,1:3] assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block 1:5:2x1:5:2" +if verbose: print("===> Block 1:5:2x1:5:2") M = Mref[1:5:2,1:5:2] assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block 1:8:3x1:5" +if verbose: print("===> Block 1:8:3x1:5") M = Mref[1:8:3,1:5] assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block transpose 1:8:3x1:6:2" +if verbose: print("===> Block transpose 1:8:3x1:6:2") M = Mref[1:8:3,0:6:2].T assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block Vector 1x0:6:2" +if verbose: print("===> Block Vector 1x0:6:2") M = Mref[1:2,0:6:2] assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block Vector 1x0:6:2 tanspose" +if verbose: print("===> Block Vector 1x0:6:2 tanspose") M = Mref[1:2,0:6:2].T assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block Vector 0:6:2x1" +if verbose: print("===> Block Vector 0:6:2x1") M = Mref[0:6:2,1:2] assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> Block Vector 0:6:2x1 tanspose" +if verbose: print("===> Block Vector 0:6:2x1 tanspose") M = Mref[0:6:2,1:2].T assert( np.array_equal(M,eigenpy.reflex(M,verbose)) ); -if verbose: print "===> From Py to Eigen::VectorXd" -if verbose: print "===> From Py to Eigen::VectorXd" -if verbose: print "===> From Py to Eigen::VectorXd" +if verbose: print("===> From Py to Eigen::VectorXd") +if verbose: print("===> From Py to Eigen::VectorXd") +if verbose: print("===> From Py to Eigen::VectorXd") -if verbose: print "===> Block Vector 0:6:2x1 1 dim" +if verbose: print("===> Block Vector 0:6:2x1 1 dim") M = Mref[0:6:2,1].T assert( np.array_equal(M.T,eigenpy.reflexV(M,verbose)) ); -if verbose: print "===> Block Vector 0:6:2x1" +if verbose: print("===> Block Vector 0:6:2x1") M = Mref[0:6:2,1:2] assert( np.array_equal(M,eigenpy.reflexV(M,verbose)) ); -if verbose: print "===> Block Vector 0:6:2x1 transpose" +if verbose: print("===> Block Vector 0:6:2x1 transpose") M = Mref[0:6:2,1:2].T assert( np.array_equal(M.T,eigenpy.reflexV(M,verbose)) ); -if verbose: print "===> From Py to Eigen::Matrix3d" -if verbose: print "===> From Py to Eigen::Matrix3d" -if verbose: print "===> From Py to Eigen::Matrix3d" +if verbose: print("===> From Py to Eigen::Matrix3d") +if verbose: print("===> From Py to Eigen::Matrix3d") +if verbose: print("===> From Py to Eigen::Matrix3d") -if verbose: print "===> Block Vector 0:3x0:6:2 " +if verbose: print("===> Block Vector 0:3x0:6:2 ") M = Mref[0:3,0:6:2] assert( np.array_equal(M,eigenpy.reflex33(M,verbose)) ); -if verbose: print "===> Block Vector 0:3x0:6:2 T" +if verbose: print("===> Block Vector 0:3x0:6:2 T") M = Mref[0:3,0:6].T try: assert( np.array_equal(M,eigenpy.reflex33(M,verbose)) ); -except eigenpy.Exception, e: - if verbose: print "As expected, got the following /ROW/ error:", e.message +except eigenpy.Exception as e: + if verbose: print("As expected, got the following /ROW/ error:", e.message) -if verbose: print "===> From Py to Eigen::Vector3d" -if verbose: print "===> From Py to Eigen::Vector3d" -if verbose: print "===> From Py to Eigen::Vector3d" +if verbose: print("===> From Py to Eigen::Vector3d") +if verbose: print("===> From Py to Eigen::Vector3d") +if verbose: print("===> From Py to Eigen::Vector3d") M = Mref[0:3,1:2] assert( np.array_equal(M,eigenpy.reflex3(M,verbose)) ); diff --git a/unittest/python/test_geometry.py b/unittest/python/test_geometry.py index 1f2642a4fbedbb3af023abdef368dcc67804acaa..5fd6638f4521b6f52ad3577d92ac56b11efa9783 100644 --- a/unittest/python/test_geometry.py +++ b/unittest/python/test_geometry.py @@ -1,3 +1,5 @@ +from __future__ import print_function + from geometry import * import numpy as np from numpy import cos,sin @@ -33,13 +35,13 @@ assert(isapprox(q.coeffs(),qR.coeffs())) assert(isapprox(qR[3],1./np.sqrt(30))) try: qR[5] - print "Error, this message should not appear." -except Exception,e: - if verbose: print "As expected, catched exception: ",e.message + print("Error, this message should not appear.") +except Exception as e: + if verbose: print("As expected, catched exception: ",e.message) # --- Angle Vector ------------------------------------------------ r = AngleAxis(.1,np.array([1,0,0],np.double)) -if verbose: print "Rx(.1) = \n\n",r.matrix(),"\n" +if verbose: print("Rx(.1) = \n\n",r.matrix(),"\n") assert( isapprox(r.matrix()[2,2],cos(r.angle))) assert( isapprox(r.axis,np.matrix("1;0;0")) ) assert( isapprox(r.angle,0.1) ) @@ -66,6 +68,6 @@ res = testInQuaternion_fx(q) assert(q.norm() == res) try: testInQuaternion(q) - print "Error, this message should not appear." + print("Error, this message should not appear.") except: - if verbose: print "As expected, catch a Boost::python::ArgError exception." + if verbose: print("As expected, catch a Boost::python::ArgError exception.")