Skip to content

Commit bea4e1d

Browse files
authored
Merge pull request matplotlib#13077 from anntzer/azure-windows
BLD/CI: default to using static libraries on windows and set up azure for all platforms
2 parents a224fc2 + 261235e commit bea4e1d

File tree

8 files changed

+195
-94
lines changed

8 files changed

+195
-94
lines changed

.appveyor.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,14 @@ install:
6868
- activate test-environment
6969
- echo %PYTHON_VERSION% %TARGET_ARCH%
7070
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
71-
- pip install -q "pytest>=3.4,!=4.6.0" "pytest-cov>=2.3.1" pytest-rerunfailures pytest-timeout pytest-xdist "pandas!=0.25.0"
71+
- pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt
7272

7373
# Apply patch to `subprocess` on Python versions > 2 and < 3.6.3
7474
# https://github.com/matplotlib/matplotlib/issues/9176
7575
- python -c "import sys; sys.exit(not (3,) < sys.version_info < (3,6,3))" && (
7676
curl -sL https://github.com/python/cpython/pull/1224.patch |
7777
patch -fsup 1 -d %CONDA_PREFIX% ) || cmd /c "exit /b 0"
7878

79-
# Let the install prefer the static builds of the libs
80-
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
81-
- mkdir lib || cmd /c "exit /b 0"
82-
- copy /y %LIBRARY_LIB%\zlibstatic.lib lib\zlib.lib
83-
- copy /y %LIBRARY_LIB%\libpng16_static.lib lib\libpng16.lib
84-
# These z.lib / png.lib are not static versions but files which end up as
85-
# dependencies to the dll file. This is fine for the conda build, but not here
86-
# and for the wheels
87-
- del %LIBRARY_LIB%\png.lib
88-
- del %LIBRARY_LIB%\z.lib
8979
# enables the local freetype build
9080
- set MPLLOCALFREETYPE=1
9181
# Show the installed packages + versions
@@ -97,9 +87,9 @@ test_script:
9787
- pip install -ve .
9888
# these should show no z, png, or freetype dll...
9989
- set "DUMPBIN=%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe"
100-
- '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd | findstr freetype.*.dll && exit /b 1 || exit /b 0'
101-
- '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\_png*.pyd | findstr z.*.dll && exit /b 1 || exit /b 0'
102-
- '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\_png*.pyd | findstr png.*.dll && exit /b 1 || exit /b 0'
90+
- 'if x%MPLSTATICBUILD% == xTrue "%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd | findstr freetype.*.dll && exit /b 1 || exit /b 0'
91+
- 'if x%MPLSTATICBUILD% == xTrue "%DUMPBIN%" /DEPENDENTS lib\matplotlib\_png*.pyd | findstr z.*.dll && exit /b 1 || exit /b 0'
92+
- 'if x%MPLSTATICBUILD% == xTrue "%DUMPBIN%" /DEPENDENTS lib\matplotlib\_png*.pyd | findstr png.*.dll && exit /b 1 || exit /b 0'
10393

10494
# this are optional dependencies so that we don't skip so many tests...
10595
- if x%TEST_ALL% == xyes conda install -q ffmpeg inkscape miktex pillow
@@ -116,6 +106,7 @@ test_script:
116106
after_test:
117107
# After the tests were a success, build wheels with the static libs
118108
# Hide the output, the copied files really clutter the build log...
109+
- set MPLSTATICBUILD=True
119110
- 'python setup.py bdist_wheel > NUL:'
120111
- dir dist\
121112
- echo finished...

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ exclude =
2828

2929
per-file-ignores =
3030
setup.py: E402
31+
setupext.py: E501
3132

3233
tools/subset.py: E221, E251, E261, E302, E501
3334

INSTALL.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,10 @@ the list of conda packages.
307307

308308
conda create -n "matplotlib_build" python=3.7 numpy python-dateutil pyparsing tornado cycler tk libpng zlib freetype msinttypes
309309
conda activate matplotlib_build
310+
# force the build against static libpng and zlib libraries
311+
set MPLSTATICBUILD=True
312+
python setup.py bdist_wheel
310313

311-
For building, call the script ``build_alllocal.cmd`` in the root folder of the
312-
repository::
313-
314-
build_alllocal.cmd
315314

316315
Conda packages
317316
^^^^^^^^^^^^^^

azure-pipelines.yml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
jobs:
77

8-
- job: 'Test'
8+
- job: 'Linux_Test'
99
pool:
10-
vmImage: 'Ubuntu 16.04'
10+
vmImage: ubuntu-16.04
1111
strategy:
1212
matrix:
1313
Python36:
@@ -17,31 +17,43 @@ jobs:
1717
maxParallel: 4
1818

1919
steps:
20-
- task: UsePythonVersion@0
21-
inputs:
22-
versionSpec: '$(python.version)'
23-
architecture: 'x64'
20+
- template: ci/azure-pipelines-steps.yml
21+
parameters:
22+
platform: ubuntu
23+
installer: apt
2424

25-
- script: |
26-
python -m pip install --upgrade pip
27-
pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt
28-
displayName: 'Install dependencies'
29-
30-
- script: |
31-
export MPLLOCALFREETYPE=1
32-
pip install -ve .
33-
displayName: "Install self"
25+
- job: 'Windows_Test'
26+
pool:
27+
vmImage: vs2017-win2016
28+
strategy:
29+
matrix:
30+
Python36:
31+
python.version: '3.6'
32+
Python37:
33+
python.version: '3.7'
34+
PythonPreview:
35+
python.version: 'Pre'
36+
maxParallel: 4
3437

35-
- script: env
36-
displayName: 'print env'
38+
steps:
39+
- template: ci/azure-pipelines-steps.yml
40+
parameters:
41+
platform: windows
42+
installer: nuget
3743

38-
- script: |
39-
env
40-
PYTHONFAULTHANDLER=1 pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 --log-level=DEBUG
41-
displayName: 'pytest'
44+
- job: 'macOS_Test'
45+
pool:
46+
vmImage: xcode9-macos10.13
47+
strategy:
48+
matrix:
49+
Python36:
50+
python.version: '3.6'
51+
Python37:
52+
python.version: '3.7'
53+
maxParallel: 4
4254

43-
- task: PublishTestResults@2
44-
inputs:
45-
testResultsFiles: '**/test-results.xml'
46-
testRunTitle: 'Python $(python.version)'
47-
condition: succeededOrFailed()
55+
steps:
56+
- template: ci/azure-pipelines-steps.yml
57+
parameters:
58+
platform: macos
59+
installer: brew

build_alllocal.cmd

Lines changed: 0 additions & 27 deletions
This file was deleted.

ci/azure-pipelines-steps.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
parameters:
2+
platform: none
3+
installer: none
4+
5+
steps:
6+
- task: UsePythonVersion@0
7+
inputs:
8+
versionSpec: '$(python.version)'
9+
architecture: 'x64'
10+
displayName: 'Use Python $(python.version)'
11+
condition: and(succeeded(), ne(variables['python.version'], 'Pre'))
12+
13+
- task: stevedower.python.InstallPython.InstallPython@1
14+
displayName: 'Use prerelease Python'
15+
inputs:
16+
prerelease: true
17+
condition: and(succeeded(), eq(variables['python.version'], 'Pre'))
18+
19+
- ${{ if eq(parameters.installer, 'nuget') }}:
20+
- task: NuGetToolInstaller@0
21+
displayName: 'Use latest available Nuget'
22+
23+
- script: |
24+
nuget install libpng-msvc14-x64 -ExcludeVersion -OutputDirectory "$(build.BinariesDirectory)"
25+
nuget install zlib-msvc14-x64 -ExcludeVersion -OutputDirectory "$(build.BinariesDirectory)"
26+
echo ##vso[task.prependpath]$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\bin_release
27+
echo ##vso[task.prependpath]$(build.BinariesDirectory)\zlib-msvc14-x64\build\native\bin_release
28+
echo ##vso[task.setvariable variable=CL]/I$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\include /I$(build.BinariesDirectory)\zlib-msvc14-x64\build\native\include
29+
echo ##vso[task.setvariable variable=LINK]/LIBPATH:$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\lib_release /LIBPATH:$(build.BinariesDirectory)\zlib-msvc14-x64\build\native\lib_release
30+
31+
displayName: 'Install dependencies with nuget'
32+
33+
- ${{ if eq(parameters.installer, 'brew') }}:
34+
- script: |
35+
brew install pkg-config ffmpeg imagemagick mplayer ccache
36+
displayName: 'Install dependencies with brew'
37+
38+
- ${{ if eq(parameters.installer, 'apt') }}:
39+
- script: |
40+
sudo apt-add-repository ppa:jonathonf/ffmpeg-3
41+
sudo apt-get update
42+
sudo apt-get install \
43+
cm-super \
44+
dvipng \
45+
ffmpeg \
46+
gdb \
47+
gir1.2-gtk-3.0 \
48+
graphviz \
49+
inkscape \
50+
libcairo2 \
51+
libgeos-dev \
52+
libgirepository-1.0.1 \
53+
lmodern \
54+
otf-freefont \
55+
pgf \
56+
texlive-fonts-recommended \
57+
texlive-latex-base \
58+
texlive-latex-extra \
59+
texlive-latex-recommended \
60+
texlive-xetex texlive-luatex
61+
displayName: 'Install dependencies with apt'
62+
63+
- script: |
64+
65+
python -m pip install --upgrade pip
66+
pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt
67+
68+
displayName: 'Install dependencies with pip'
69+
70+
- script: |
71+
72+
pip install -ve .
73+
74+
displayName: "Install self"
75+
env:
76+
MPLLOCALFREETYPE: 1
77+
78+
- script: env
79+
displayName: 'print env'
80+
81+
- script: |
82+
env
83+
pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2
84+
displayName: 'pytest'
85+
env:
86+
PYTHONFAULTHANDLER: 1
87+
88+
- task: PublishTestResults@2
89+
inputs:
90+
testResultsFiles: '**/test-results.xml'
91+
testRunTitle: 'Python $(python.version)'
92+
condition: succeededOrFailed()

setup.cfg.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@
6161
# modules. The default is determined by fallback.
6262
#
6363
#backend = Agg
64+
65+
[build]
66+
# Build options
67+
# If we should try to use static libraries on Windows
68+
#staticbuild = True

0 commit comments

Comments
 (0)