Skip to content

fix FreeType build on Azure #13077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,14 @@ install:
- activate test-environment
- echo %PYTHON_VERSION% %TARGET_ARCH%
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
- pip install -q "pytest>=3.4,!=4.6.0" "pytest-cov>=2.3.1" pytest-rerunfailures pytest-timeout pytest-xdist "pandas!=0.25.0"
- pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt

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

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

# this are optional dependencies so that we don't skip so many tests...
- if x%TEST_ALL% == xyes conda install -q ffmpeg inkscape miktex pillow
Expand All @@ -116,6 +106,7 @@ test_script:
after_test:
# After the tests were a success, build wheels with the static libs
# Hide the output, the copied files really clutter the build log...
- set MPLSTATICBUILD=True
- 'python setup.py bdist_wheel > NUL:'
- dir dist\
- echo finished...
Expand Down
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ exclude =

per-file-ignores =
setup.py: E402
setupext.py: E501

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

Expand Down
7 changes: 3 additions & 4 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,10 @@ the list of conda packages.

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

For building, call the script ``build_alllocal.cmd`` in the root folder of the
repository::

build_alllocal.cmd

Conda packages
^^^^^^^^^^^^^^
Expand Down
64 changes: 38 additions & 26 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

jobs:

- job: 'Test'
- job: 'Linux_Test'
pool:
vmImage: 'Ubuntu 16.04'
vmImage: ubuntu-16.04
strategy:
matrix:
Python36:
Expand All @@ -17,31 +17,43 @@ jobs:
maxParallel: 4

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

- script: |
python -m pip install --upgrade pip
pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt
displayName: 'Install dependencies'

- script: |
export MPLLOCALFREETYPE=1
pip install -ve .
displayName: "Install self"
- job: 'Windows_Test'
pool:
vmImage: vs2017-win2016
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
PythonPreview:
python.version: 'Pre'
maxParallel: 4

- script: env
displayName: 'print env'
steps:
- template: ci/azure-pipelines-steps.yml
parameters:
platform: windows
installer: nuget

- script: |
env
PYTHONFAULTHANDLER=1 pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 --log-level=DEBUG
displayName: 'pytest'
- job: 'macOS_Test'
pool:
vmImage: xcode9-macos10.13
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
maxParallel: 4

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
steps:
- template: ci/azure-pipelines-steps.yml
parameters:
platform: macos
installer: brew
27 changes: 0 additions & 27 deletions build_alllocal.cmd

This file was deleted.

92 changes: 92 additions & 0 deletions ci/azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
parameters:
platform: none
installer: none

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: 'Use Python $(python.version)'
condition: and(succeeded(), ne(variables['python.version'], 'Pre'))

- task: stevedower.python.InstallPython.InstallPython@1
displayName: 'Use prerelease Python'
inputs:
prerelease: true
condition: and(succeeded(), eq(variables['python.version'], 'Pre'))

- ${{ if eq(parameters.installer, 'nuget') }}:
- task: NuGetToolInstaller@0
displayName: 'Use latest available Nuget'

- script: |
nuget install libpng-msvc14-x64 -ExcludeVersion -OutputDirectory "$(build.BinariesDirectory)"
nuget install zlib-msvc14-x64 -ExcludeVersion -OutputDirectory "$(build.BinariesDirectory)"
echo ##vso[task.prependpath]$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\bin_release
echo ##vso[task.prependpath]$(build.BinariesDirectory)\zlib-msvc14-x64\build\native\bin_release
echo ##vso[task.setvariable variable=CL]/I$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\include /I$(build.BinariesDirectory)\zlib-msvc14-x64\build\native\include
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

displayName: 'Install dependencies with nuget'

- ${{ if eq(parameters.installer, 'brew') }}:
- script: |
brew install pkg-config ffmpeg imagemagick mplayer ccache
displayName: 'Install dependencies with brew'

- ${{ if eq(parameters.installer, 'apt') }}:
- script: |
sudo apt-add-repository ppa:jonathonf/ffmpeg-3
sudo apt-get update
sudo apt-get install \
cm-super \
dvipng \
ffmpeg \
gdb \
gir1.2-gtk-3.0 \
graphviz \
inkscape \
libcairo2 \
libgeos-dev \
libgirepository-1.0.1 \
lmodern \
otf-freefont \
pgf \
texlive-fonts-recommended \
texlive-latex-base \
texlive-latex-extra \
texlive-latex-recommended \
texlive-xetex texlive-luatex
displayName: 'Install dependencies with apt'

- script: |

python -m pip install --upgrade pip
pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt

displayName: 'Install dependencies with pip'

- script: |

pip install -ve .

displayName: "Install self"
env:
MPLLOCALFREETYPE: 1

- script: env
displayName: 'print env'

- script: |
env
pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2
displayName: 'pytest'
env:
PYTHONFAULTHANDLER: 1

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
5 changes: 5 additions & 0 deletions setup.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@
# modules. The default is determined by fallback.
#
#backend = Agg

[build]
# Build options
# If we should try to use static libraries on Windows
#staticbuild = True
Loading