ci: workaround homebrew issues with python and numpy on Travis's macOS 10.12

Change-Id: I772e13c5395c1fd3467f8405baadd0bb4f795104
diff --git a/.travis.yml b/.travis.yml
index 6868f51..b1deb97 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -92,6 +92,11 @@
 before_script:
   - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-16.04"; fi
   - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi
+  - if [[ ${OSX_VERSION} == 10.12 ]]; then brew update; fi
+  # workaround for https://github.com/Homebrew/homebrew-core/issues/26358
+  - if [[ ${OSX_VERSION} == 10.12 ]]; then brew outdated python || brew upgrade python; fi
+  # workaround for https://github.com/travis-ci/travis-ci/issues/6688
+  - if [[ ${OSX_VERSION} == 10.12 ]]; then /usr/bin/yes | pip2 uninstall numpy || true; fi
   - if [[ -n ${COMPILER} ]]; then export CXX=${COMPILER}; fi
   - ${CXX:-c++} --version
   - python --version