Skip to content

Commit c3affbd

Browse files
committed
Merge branch 'fix-control-347' into sg03ad-N-docchange
2 parents 300244e + 47e780c commit c3affbd

22 files changed

Lines changed: 536 additions & 691 deletions

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[run]
22
source = slycot
3+
omit = */tests/*

.travis.yml

Lines changed: 125 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,153 @@
1-
# The test matrix includes OSX and Linux
2-
3-
# Don't know how to do non-Conda builds on OSX
4-
5-
# Linux builds needs extra settings (see "dist" and "services" below)
6-
7-
matrix:
8-
allow_failures:
9-
- name: "OSX, Python 2.7, TEST_CONDA=1"
10-
os: osx
11-
env: SLYCOT_PYTHON_VERSION=2.7 TEST_CONDA=1
12-
13-
- name: "OSX, Python 3.5, TEST_CONDA=1"
14-
os: osx
15-
env: SLYCOT_PYTHON_VERSION=3.5 TEST_CONDA=1
16-
17-
- name: "OSX, Python 3.6, TEST_CONDA=1"
18-
os: osx
19-
env: SLYCOT_PYTHON_VERSION=3.6 TEST_CONDA=1
20-
21-
- name: "OSX, Python 3.7, TEST_CONDA=1"
22-
os: osx
23-
env: SLYCOT_PYTHON_VERSION=3.7 TEST_CONDA=1
24-
1+
# Default entries for matrix jobs
2+
os: linux
3+
language: python
4+
dist: bionic
5+
services: xvfb # needed for the python-control tests
6+
7+
# Start with a 2x4 matrix of Linux builds
8+
python:
9+
- "3.8"
10+
- "3.7"
11+
env:
12+
- TEST_PKG="conda" BLA_VENDOR="OpenBLAS"
13+
- TEST_PKG="conda" BLA_VENDOR="Intel10_64lp" # MKL
14+
- TEST_PKG="dist" BLA_VENDOR="OpenBLAS"
15+
- TEST_PKG="dist" BLA_VENDOR="Generic" # reference BLAS/LAPACK
16+
17+
jobs:
18+
# additional single Linux and OSX jobs
2519
include:
26-
- name: "OSX, Python 2.7, TEST_CONDA=1"
20+
- name: "Linux, Conda Python 3.6"
21+
python: "3.6"
22+
env: TEST_PKG="conda" BLA_VENDOR="OpenBLAS"
23+
- name: "Linux, Conda Python 3.5"
24+
python: "3.5"
25+
env: TEST_PKG="conda" BLA_VENDOR="OpenBLAS"
26+
- name: "Linux, Ubuntu 16.04, System Python 2.7"
27+
python: "2.7"
28+
dist: xenial
29+
env: TEST_PKG="dist" BLA_VENDOR="OpenBLAS"
30+
# (Conda Python 2 is broken due to pytest-cov dependencies)
31+
- name: "MacOSX, Conda Python 3"
2732
os: osx
28-
env: SLYCOT_PYTHON_VERSION=2.7 TEST_CONDA=1
29-
30-
- name: "OSX, Python 3.5, TEST_CONDA=1"
33+
language: shell
34+
env: TEST_PKG="conda" BLA_VENDOR="Apple"
35+
- name: "MacOSX, System Python 3"
3136
os: osx
32-
env: SLYCOT_PYTHON_VERSION=3.5 TEST_CONDA=1
33-
34-
- name: "OSX, Python 3.6, TEST_CONDA=1"
37+
language: shell
38+
env: TEST_PKG="dist" BLA_VENDOR="Apple"
39+
- name: "MacOSX, pyenv 3.8.0"
3540
os: osx
36-
env: SLYCOT_PYTHON_VERSION=3.6 TEST_CONDA=1
37-
38-
- name: "OSX, Python 3.7, TEST_CONDA=1"
41+
language: shell
42+
env: TEST_PKG="dist" BLA_VENDOR="Apple" SLYCOT_PYTHON_VERSION=3.8.0
43+
- name: "MacOSX, pyenv 2.7.17"
3944
os: osx
40-
env: SLYCOT_PYTHON_VERSION=3.7 TEST_CONDA=1
41-
42-
- name: "Ubuntu 16.04, Python 2.7, TEST_CONDA=0"
43-
os: linux
44-
dist: xenial
45-
services: xvfb
46-
env: SLYCOT_PYTHON_VERSION=2.7 TEST_CONDA=0
47-
48-
- name: "Ubuntu 16.04, Python 2.7, TEST_CONDA=1"
49-
os: linux
50-
dist: xenial
51-
services: xvfb
52-
env: SLYCOT_PYTHON_VERSION=2.7 TEST_CONDA=1
53-
54-
- name: "Ubuntu 16.04, Python 3.5, TEST_CONDA=0"
55-
os: linux
56-
dist: xenial
57-
services: xvfb
58-
env: SLYCOT_PYTHON_VERSION=3.5 TEST_CONDA=0
59-
60-
- name: "Ubuntu 16.04, Python 3.5, TEST_CONDA=1"
61-
os: linux
62-
dist: xenial
63-
services: xvfb
64-
env: SLYCOT_PYTHON_VERSION=3.5 TEST_CONDA=1
65-
66-
- name: "Ubuntu 16.04, Python 3.6, TEST_CONDA=0"
67-
os: linux
68-
dist: xenial
69-
services: xvfb
70-
env: SLYCOT_PYTHON_VERSION=3.6 TEST_CONDA=0
71-
72-
- name: "Ubuntu 16.04, Python 3.6, TEST_CONDA=1"
73-
os: linux
74-
dist: xenial
75-
services: xvfb
76-
env: SLYCOT_PYTHON_VERSION=3.6 TEST_CONDA=1
77-
78-
- name: "Ubuntu 16.04, Python 3.7, TEST_CONDA=0"
79-
os: linux
80-
dist: xenial
81-
services: xvfb
82-
env: SLYCOT_PYTHON_VERSION=3.7 TEST_CONDA=0
83-
84-
- name: "Ubuntu 16.04, Python 3.7, TEST_CONDA=1"
85-
os: linux
86-
dist: xenial
87-
services: xvfb
88-
env: SLYCOT_PYTHON_VERSION=3.7 TEST_CONDA=1
45+
language: shell
46+
env: TEST_PKG="dist" BLA_VENDOR="Apple" SLYCOT_PYTHON_VERSION=2.7.17
8947

9048

9149
before_install:
92-
- if [[ $TEST_CONDA == 0 && $TRAVIS_OS_NAME != linux ]]; then
93-
echo "Only Linux supported for non-Conda builds";
94-
exit 1;
50+
- |
51+
# Install Ubuntu packages
52+
if [[ $TEST_PKG == "dist" && $TRAVIS_OS_NAME == linux ]]; then
53+
sudo apt-get update
54+
sudo apt-get -y install gfortran cmake
55+
if [[ $BLA_VENDOR == "OpenBLAS" ]]; then
56+
sudo apt-get -y install libopenblas-dev
57+
elif [[ $BLA_VENDOR == "Generic" ]]; then
58+
sudo apt-get -y install libblas-dev liblapack-dev
59+
else
60+
echo "Unsupported BLAS Vendor: '$BLA_VENDOR'"
61+
exit 2
62+
fi
9563
fi
96-
# from here on assume $TEST_CONDA == 0 implies $TRAVIS_OS_NAME == linux
97-
98-
- if [[ $TEST_CONDA == 0 ]]; then
99-
sudo apt-get install liblapack-dev libblas-dev;
100-
sudo apt-get install gfortran;
101-
sudo apt-get install cmake;
64+
- |
65+
# Install MacOSX packages
66+
if [[ $TEST_PKG == "dist" && $TRAVIS_OS_NAME == osx ]]; then
67+
if [ -n "$SLYCOT_PYTHON_VERSION" ]; then
68+
pyenv install $SLYCOT_PYTHON_VERSION
69+
pyenv global $SLYCOT_PYTHON_VERSION
70+
eval "$(pyenv init -)"
71+
export MPLBACKEND="TkAgg"
72+
else
73+
mkdir -p ~/.local/bin
74+
ln -s $(which python3) ~/.local/bin/python
75+
ln -s $(which pip3) ~/.local/bin/pip
76+
fi
10277
fi
10378
104-
10579
install:
106-
#
107-
# Install miniconda to allow quicker installation of dependencies
108-
# See https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html
109-
#
110-
- if [[ $TRAVIS_OS_NAME == linux ]]; then
111-
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
112-
else
113-
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
114-
fi
115-
- bash miniconda.sh -b -p $HOME/miniconda
116-
- export PATH="$HOME/miniconda/bin:$PATH"
117-
- hash -r
118-
- conda config --set always_yes yes --set changeps1 no
119-
- conda update -q --all
120-
- if [[ $TEST_CONDA == 1 ]]; then
121-
conda install conda-build;
122-
conda install conda-verify;
123-
fi
124-
- conda info -a
125-
#
126-
# Set up a test environment for testing everything out
127-
- conda create -q -n test-environment python="$SLYCOT_PYTHON_VERSION" pip coverage nose numpy openblas
128-
- source activate test-environment
129-
130-
#
131-
# Make sure that fortran compiler can find conda libraries
132-
#
133-
- export LIBRARY_PATH="$HOME/miniconda/envs/test-environment/lib";
134-
135-
# install scikit-build
136-
- if [[ $TEST_CONDA == 0 ]]; then
137-
conda config --append channels conda-forge;
138-
conda install -c conda-forge scikit-build >=0.8.0 ;
139-
fi
140-
#
141-
# Install the slycot package (two ways, to improve robustness). For the
142-
# conda version, need to install lapack from conda-forge (no way to specify
143-
# this in the recipe).
144-
# add the conda-forge channel to the config, otherwise openblas or
145-
# lapack cannot be found in the check
146-
# with --override-channels to make sure the locally built slycot is installed
147-
#
148-
- if [[ $TEST_CONDA == 1 ]]; then
80+
- |
81+
# compile using conda environment or distribution libraries
82+
echo "Python Version: ${SLYCOT_PYTHON_VERSION:=${TRAVIS_PYTHON_VERSION:-3.8}}"
83+
if [[ $TEST_PKG == conda ]]; then
84+
#
85+
# Install miniconda to allow quicker installation of dependencies
86+
# See https://conda.io/projects/conda/en/latest/user-guide/tasks/use-conda-with-travis-ci.html
87+
#
88+
if [[ $TRAVIS_OS_NAME == linux ]]; then
89+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
90+
elif [[ $TRAVIS_OS_NAME == osx ]]; then
91+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh
92+
wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.9.sdk.tar.xz
93+
sudo tar -C /opt -xJf MacOSX10.9.sdk.tar.xz
94+
else
95+
echo "Unsupported OS for conda builds: $TRAVIS_OS_NAME"
96+
exit 4
97+
fi
98+
bash miniconda.sh -b -p $HOME/miniconda
99+
source "$HOME/miniconda/etc/profile.d/conda.sh"
100+
hash -r
101+
conda config --set always_yes yes --set changeps1 no
102+
conda update -q --all
103+
conda install conda-build
104+
conda install conda-verify
149105
conda config --append channels conda-forge;
150-
conda build --python "$SLYCOT_PYTHON_VERSION" conda-recipe-openblas;
151-
conda install conda-forge::openblas>=0.3.0;
152-
conda install local::slycot;
106+
conda info -a;
107+
if [[ $BLA_VENDOR == "OpenBLAS" ]]; then
108+
conda_blas=openblas
109+
conda_recipe=conda-recipe-openblas
110+
elif [[ $BLA_VENDOR == "Intel10_64lp" ]]; then
111+
conda_blas=mkl
112+
conda_recipe=conda-recipe-mkl
113+
elif [[ $BLA_VENDOR == "Apple" ]]; then
114+
conda_blas=
115+
conda_recipe=conda-recipe-apple
116+
else
117+
echo "Unsupported BLA_VENDOR for conda builds: $BLA_VENDOR"
118+
exit 3
119+
fi
120+
conda create -q -n test-environment \
121+
python="$SLYCOT_PYTHON_VERSION" \
122+
pip coverage pytest-cov \
123+
numpy scipy matplotlib \
124+
$conda_blas
125+
conda activate test-environment
126+
export LIBRARY_PATH="$HOME/miniconda/envs/test-environment/lib"
127+
conda build --python "$SLYCOT_PYTHON_VERSION" $conda_recipe
128+
conda install local::slycot
129+
elif [[ $TEST_PKG == dist ]]; then
130+
pip install scikit-build pytest-cov matplotlib scipy;
131+
CMAKE_GENERATOR="Unix Makefiles" python setup.py install;
153132
else
154-
CMAKE_GENERATOR="Unix Makefiles" BLA_VENDOR="OpenBLAS" python setup.py install;
133+
echo "Wrong TEST_PKG '$TEST_PKG'"
134+
exit 1
155135
fi
156-
#
157-
# coveralls not in conda repos :-(
158-
- pip install coveralls
159-
136+
# coveralls not in ubuntu or conda repos
137+
pip install coveralls
160138
161139
script:
162-
# Local unit tests
163-
# TODO: replace with nose?
140+
# slycots own unit tests as installed, not those from source dir
164141
- cd ..
165-
- python Slycot/runtests.py --coverage --no-build
142+
- slycot_dir=$(python -c "import slycot; print(slycot.__path__[0])")
143+
- pytest --pyargs slycot --cov=$slycot_dir --cov-config=Slycot/.coveragerc
166144
#
167145
# As a deeper set of tests, get test against python-control as well
168146
#
169-
# Additional packages required for python-control
170-
- conda install scipy matplotlib
171147
# Get python-control from source and install
172148
- git clone --depth 1 https://github.com/python-control/python-control.git control
173149
- cd control
174150
- python setup.py test
175151

176-
177152
after_success:
178153
- coveralls

conda-recipe-apple/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export LDFLAGS="$LDFLAGS -v"
2+
if [[ "$target_platform" == osx-64 ]]; then
3+
export LDFLAGS="${LDFLAGS} -isysroot ${CONDA_BUILD_SYSROOT}"
4+
export CFLAGS="${CFLAGS} -isysroot ${CONDA_BUILD_SYSROOT}"
5+
fi
6+
$PYTHON setup.py build_ext install -- -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONDA_BUILD_SYSROOT:
2+
- /opt/MacOSX10.9.sdk

conda-recipe-apple/meta.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package:
2+
name: slycot
3+
version: {{ environ.get('GIT_DESCRIBE_TAG', 'v0.0.0')[1:] }}
4+
5+
source:
6+
git_url: ../
7+
8+
build:
9+
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
10+
string: py{{ environ.get('PY_VER').replace('.', '') }}{{ environ.get('GIT_DESCRIBE_HASH', '') }}_mkl_{{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
11+
12+
requirements:
13+
build:
14+
- {{ compiler('c') }}
15+
- {{ compiler('fortran') }} # [unix]
16+
- flang # [win]
17+
18+
host:
19+
- numpy
20+
- python
21+
# conda-forge::scikit-build>=0.10.0 includes MACOSX_DEPLOYMENT_TARGET
22+
# patches from https://github.com/scikit-build/scikit-build/pull/441
23+
- scikit-build >=0.10.0
24+
25+
run:
26+
- python
27+
- {{ pin_compatible('numpy') }}
28+
29+
test:
30+
imports:
31+
- slycot
32+
33+
about:
34+
home: https://github.com/python-control/Slycot
35+
dev_url: https://github.com/python-control/Slycot
36+
license: GPL-2.0
37+
license_family: GPL
38+
license_file: COPYING
39+
summary: 'Slycot: A wrapper for the SLICOT control and systems library'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cd $RECIPE_DIR/..
22

33
# specify blas vendor should be MKL
4-
export DBLA_VENDOR=Intel10_64lp
4+
export BLA_VENDOR=Intel10_64lp
55

66
# ensure we are not building with old cmake files
77
rm -rf _skbuild
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ requirements:
2323
- pip
2424

2525
run:
26-
- python
26+
- python {{ PY_VER }}
2727
- {{ pin_compatible('numpy') }}
2828
- mkl
2929

0 commit comments

Comments
 (0)