From 5ed5a66a40d81feb22613cf0422a953c238d0895 Mon Sep 17 00:00:00 2001
From: Matthew Brett <matthew.brett@gmail.com>
Date: Sat, 27 Mar 2021 11:26:47 +0000
Subject: [PATCH 1/5] Strip to 3.9 job only

---
 .travis.yml  | 75 ----------------------------------------
 appveyor.yml | 97 ----------------------------------------------------
 2 files changed, 172 deletions(-)
 delete mode 100644 appveyor.yml

diff --git a/.travis.yml b/.travis.yml
index 5b215f0..bfdf0d7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,81 +25,6 @@ matrix:
       # Exclude the default Python 3.5 build
       - python: 3.5
   include:
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=2.7
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=2.7
-        - UNICODE_WIDTH=16
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=2.7
-        - PLAT=i686
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=2.7
-        - PLAT=i686
-        - UNICODE_WIDTH=16
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.6
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.6
-        - PLAT=i686
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.7
-        - NP_BUILD_DEP="numpy==1.15"
-        - NP_TEST_DEP="numpy==1.15"
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.7
-        - NP_BUILD_DEP="numpy==1.15"
-        - NP_TEST_DEP="numpy==1.15"
-        - PLAT=i686
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.8
-        - NP_BUILD_DEP="numpy==1.18"
-        - NP_TEST_DEP="numpy==1.18"
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.8
-        - NP_BUILD_DEP="numpy==1.18"
-        - NP_TEST_DEP="numpy==1.18"
-        - PLAT=i686
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.9
-        - NP_BUILD_DEP="numpy==1.20"
-        - NP_TEST_DEP="numpy==1.20"
-    - os: linux
-      env:
-        - MB_PYTHON_VERSION=3.9
-        - NP_BUILD_DEP="numpy==1.20"
-        - NP_TEST_DEP="numpy==1.20"
-        - PLAT=i686
-    - os: osx
-      language: generic
-      env: MB_PYTHON_VERSION=2.7
-    - os: osx
-      language: generic
-      env:
-        - MB_PYTHON_VERSION=3.6
-    - os: osx
-      language: generic
-      env:
-        - MB_PYTHON_VERSION=3.7
-        - NP_BUILD_DEP="numpy==1.15"
-        - NP_TEST_DEP="numpy==1.15"
-    - os: osx
-      language: generic
-      env:
-        - MB_PYTHON_VERSION=3.8
-        - NP_BUILD_DEP="numpy==1.18"
-        - NP_TEST_DEP="numpy==1.18"
     - os: osx
       language: generic
       env:
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 75a0131..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,97 +0,0 @@
-# vim ft=yaml
-# CI on Windows via appveyor
-
-environment:
-  global:
-    BUILD_COMMIT: master
-    NP_BUILD_DEP: "numpy==1.14"
-    NP_TEST_DEP: "numpy==1.14"
-    SP_DEP: "scipy"
-    ANACONDA_ORG: "nipy"
-    EXTRA_FLAGS: ""
-    ANACONDA_SECRET:
-      secure: Ds0PkQD0b/QOfoNoiPuFJb01zg0Mq0dkAxIG2jRXocCAereSXdWw6XYaDrutHWme
-
-  matrix:
-    - PYTHON: C:\Python27
-    - PYTHON: C:\Python27-x64
-      # Doctest fail from the Ls as in (1L, 2L) != (1, 2)
-      EXTRA_FLAGS: "--without-doctest"
-    - PYTHON: C:\Python36
-    - PYTHON: C:\Python36-x64
-    - PYTHON: C:\Python37
-      NP_BUILD_DEP: "numpy==1.15"
-      NP_TEST_DEP: "numpy==1.15"
-    - PYTHON: C:\Python37-x64
-      NP_BUILD_DEP: "numpy==1.15"
-      NP_TEST_DEP: "numpy==1.15"
-    - PYTHON: C:\Python38
-      # https://stackoverflow.com/a/58582651/1939576
-      EXTRA_FLAGS: "--traverse-namespace"
-      NP_BUILD_DEP: "numpy==1.18"
-      NP_TEST_DEP: "numpy==1.18"
-    - PYTHON: C:\Python38-x64
-      EXTRA_FLAGS: "--traverse-namespace"
-      NP_BUILD_DEP: "numpy==1.18"
-      NP_TEST_DEP: "numpy==1.18"
-    - PYTHON: C:\Python39
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-      EXTRA_FLAGS: "--traverse-namespace"
-      NP_BUILD_DEP: "numpy==1.20"
-      NP_TEST_DEP: "numpy==1.20"
-    - PYTHON: C:\Python39-x64
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-      EXTRA_FLAGS: "--traverse-namespace"
-      NP_BUILD_DEP: "numpy==1.20"
-      NP_TEST_DEP: "numpy==1.20"
-
-install:
-  # Prepend newly installed Python to the PATH of this build (this cannot be
-  # done from inside the powershell script as it would require to restart
-  # the parent CMD process).
-  - SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
-  - python -m pip install -U pip setuptools
-
-  # Fix MSVC builds for 64-bit Python. See:
-  # http://stackoverflow.com/questions/32091593/cannot-install-windows-sdk-7-1-on-windows-10
-  - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64/vcvars64.bat"
-
-  # Install the dependencies of the project.
-  - pip install %NP_BUILD_DEP% Cython nose nibabel sympy scipy
-  # Pin wheel to 0.26 to avoid Windows ABI tag for built wheel
-  - pip install wheel==0.26
-  # Build wheel
-  - cd nipy
-  - git submodule update --init
-  - git checkout %BUILD_COMMIT%
-  - python setup.py bdist_wheel
-  - cd ..
-
-build: false  # Not a C# project, build stuff at the test step instead.
-
-test_script:
-  - pip install %NP_TEST_DEP%
-  - pip install --pre --no-index --find-links .\nipy\dist nipy
-  # Change into an innocuous directory and find tests from installation
-  - mkdir for_testing
-  - cd for_testing
-  - python --version
-  - python ..\nipy\tools\nipnost %EXTRA_FLAGS% nipy
-  - cd ..
-
-artifacts:
-  # Archive the generated wheel package in the ci.appveyor.com build report.
-  - path: nipy\dist\*
-
-on_success:
-  # Upload the generated wheel package to Anaconda.org
-  - pip install git+https://github.com/Anaconda-Platform/anaconda-project
-  - pip install git+https://github.com/Anaconda-Platform/anaconda-client
-  - anaconda -t %ANACONDA_SECRET% upload --force -u %ANACONDA_ORG% nipy\dist\*.whl
-
-cache:
-  # Use the appveyor cache to avoid re-downloading large archives such
-  # the MKL numpy and scipy wheels mirrored on a rackspace cloud
-  # container, speed up the appveyor jobs and reduce bandwidth
-  # usage on our rackspace account.
-  - '%APPDATA%\pip\Cache'

From ed181eb4eca2840a6c4ae4d85d6c66803e40c9e2 Mon Sep 17 00:00:00 2001
From: Matthew Brett <matthew.brett@gmail.com>
Date: Sat, 27 Mar 2021 11:34:03 +0000
Subject: [PATCH 2/5] Oops - we don't have Numpy yet.

---
 config.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/config.sh b/config.sh
index 38956ba..ce37ab5 100644
--- a/config.sh
+++ b/config.sh
@@ -5,11 +5,15 @@ function pre_build {
     # Any stuff that you need to do before you start
     # building the wheels.
     # Runs in the root directory of this repository.
-    # Accelerate error only on macOS
+    # Workaround for Accelerate error; only on macOS.
     if [ -z "$IS_MACOS" ]; then return; fi
-    # Only for Numpy >= 1.20
-    local np_ver=$(python -c 'import numpy; print(numpy.__version__)')
-    if [ $(lex_ver $np_ver) -lt $(lex_ver 1.20) ]; then
+    # We need NP_BUILD_DEP to know which Numpy we will
+    # get - so this variable must be defined here.
+    # It will be for macOS builds that see the env vars
+    # from the travis config.
+    if [ -z "$NP_BUILD_DEP" ]; then return; fi
+    # Problem only arises for Numpy >= 1.20
+    if [ $(lex_ver $NP_BUILD_DEP) -lt $(lex_ver 1.20) ]; then
         return
     fi
     # Just in case.

From f13b0c231f01849ffbedc6137a9677015f9a9dd8 Mon Sep 17 00:00:00 2001
From: Matthew Brett <matthew.brett@gmail.com>
Date: Sat, 27 Mar 2021 12:01:09 +0000
Subject: [PATCH 3/5] Try more sophisticated parsing

---
 config.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/config.sh b/config.sh
index ce37ab5..60b537f 100644
--- a/config.sh
+++ b/config.sh
@@ -12,8 +12,13 @@ function pre_build {
     # It will be for macOS builds that see the env vars
     # from the travis config.
     if [ -z "$NP_BUILD_DEP" ]; then return; fi
+    local np_ver=$(echo $NP_BUILD_DEP | sed -r 's/^numpy[=<>! ]+([0-9.]+)/\1/')
+    if ! [[ $np_ver =~ ^[0-9.]+$ ]]; then
+        echo "Could not parse NP_BUILD_DEP $NP_BUILD_DEP"
+        exit 1
+    fi
     # Problem only arises for Numpy >= 1.20
-    if [ $(lex_ver $NP_BUILD_DEP) -lt $(lex_ver 1.20) ]; then
+    if [ $(lex_ver $np_ver) -lt $(lex_ver 1.20) ]; then
         return
     fi
     # Just in case.

From 7da126999807eadc406f9ca60f9ae9c61147d7a9 Mon Sep 17 00:00:00 2001
From: Matthew Brett <matthew.brett@gmail.com>
Date: Sat, 27 Mar 2021 12:12:26 +0000
Subject: [PATCH 4/5] Try -E flag

---
 config.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.sh b/config.sh
index 60b537f..97f2658 100644
--- a/config.sh
+++ b/config.sh
@@ -12,9 +12,9 @@ function pre_build {
     # It will be for macOS builds that see the env vars
     # from the travis config.
     if [ -z "$NP_BUILD_DEP" ]; then return; fi
-    local np_ver=$(echo $NP_BUILD_DEP | sed -r 's/^numpy[=<>! ]+([0-9.]+)/\1/')
+    local np_ver=$(echo $NP_BUILD_DEP | sed -E 's/^numpy[=<>! ]+([0-9.]+)/\1/')
     if ! [[ $np_ver =~ ^[0-9.]+$ ]]; then
-        echo "Could not parse NP_BUILD_DEP $NP_BUILD_DEP"
+        echo "Could not parse NP_BUILD_DEP=$NP_BUILD_DEP"
         exit 1
     fi
     # Problem only arises for Numpy >= 1.20

From 6ec591b3b65f099ef87804a4d93e4da211f57636 Mon Sep 17 00:00:00 2001
From: Matthew Brett <matthew.brett@gmail.com>
Date: Sat, 27 Mar 2021 12:18:33 +0000
Subject: [PATCH 5/5] Adapt openblas spec to homebrew locations

---
 site.cfg.openblas | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/site.cfg.openblas b/site.cfg.openblas
index 84793a8..932a434 100644
--- a/site.cfg.openblas
+++ b/site.cfg.openblas
@@ -1,5 +1,5 @@
 [openblas]
 libraries = openblas
-library_dirs = /usr/local/lib
-include_dirs = /usr/local/include
-runtime_library_dirs = /usr/local/lib
+library_dirs = /usr/local/opt/openblas/lib
+include_dirs = /usr/local/opt/openblas/include
+runtime_library_dirs = /usr/local/opt/opeblas/lib
