From 5a3eeee4e8ab3e7579119adca77baa881af667c7 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 12 Dec 2018 16:16:24 -0800 Subject: [PATCH 01/12] Adds macOS and Windows builds to Azure Pipelines --- azure-pipelines.yml | 60 ++++++++++++++++++------------------ ci/azure-pipelines-steps.yml | 42 +++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 ci/azure-pipelines-steps.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b3ae38c8a57d..9e99040d5a2a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,9 +5,9 @@ jobs: -- job: 'Test' +- job: 'Linux tests' pool: - vmImage: 'Ubuntu 16.04' + vmImage: ubuntu-16.04 strategy: matrix: Python36: @@ -17,35 +17,35 @@ jobs: maxParallel: 4 steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' + - template: ci/azure-pipelines-steps.yml - - 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 tests' + pool: + vmImage: win2016-vs2017 + strategy: + matrix: + Python36: + python.version: '3.6' + Python37: + python.version: '3.7' + # Disabled until a required extension is installed + #PythonPreview: + # python.version: 'Pre' + maxParallel: 4 - - script: env - displayName: 'print env' + steps: + - template: ci/azure-pipelines-steps.yml - - script: | - env - pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 - displayName: 'pytest' +- job: 'macOS tests' + 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 diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml new file mode 100644 index 000000000000..d28fd5bc1d5e --- /dev/null +++ b/ci/azure-pipelines-steps.yml @@ -0,0 +1,42 @@ +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')) + +- script: | + + python -m pip install --upgrade pip + pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt + + displayName: 'Install dependencies' + +- 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' + +- task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test-results.xml' + testRunTitle: 'Python $(python.version)' + condition: succeededOrFailed() From d265333c937afe5872b618541b6c2c7f6d9974f9 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 12 Dec 2018 16:18:12 -0800 Subject: [PATCH 02/12] Correct VM image name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9e99040d5a2a..19d336ef86cf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ jobs: - job: 'Windows tests' pool: - vmImage: win2016-vs2017 + vmImage: vs2017-win2016 strategy: matrix: Python36: From 66cc41da758236397b6b649b4a6122e3e17b557d Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 12 Dec 2018 16:20:06 -0800 Subject: [PATCH 03/12] Fix job names and remove extension reference --- azure-pipelines.yml | 6 +++--- ci/azure-pipelines-steps.yml | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 19d336ef86cf..3bb27e283743 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,7 +5,7 @@ jobs: -- job: 'Linux tests' +- job: 'Linux_Test' pool: vmImage: ubuntu-16.04 strategy: @@ -19,7 +19,7 @@ jobs: steps: - template: ci/azure-pipelines-steps.yml -- job: 'Windows tests' +- job: 'Windows_Test' pool: vmImage: vs2017-win2016 strategy: @@ -36,7 +36,7 @@ jobs: steps: - template: ci/azure-pipelines-steps.yml -- job: 'macOS tests' +- job: 'macOS_Test' pool: vmImage: xcode9-macos10.13 strategy: diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml index d28fd5bc1d5e..fbc12d81878b 100644 --- a/ci/azure-pipelines-steps.yml +++ b/ci/azure-pipelines-steps.yml @@ -6,11 +6,12 @@ steps: 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')) +# Disabled until extension is added +#- task: stevedower.python.InstallPython.InstallPython@1 +# displayName: 'Use prerelease Python' +# inputs: +# prerelease: true +# condition: and(succeeded(), eq(variables['python.version'], 'Pre')) - script: | From 23426c5d4d84a510801d601edf2809faa3fb875e Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 12 Dec 2018 16:31:26 -0800 Subject: [PATCH 04/12] Add dependency installs for macOS and Ubuntu --- azure-pipelines.yml | 6 ++++++ ci/azure-pipelines-steps.yml | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3bb27e283743..b9081d2620fe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,6 +18,8 @@ jobs: steps: - template: ci/azure-pipelines-steps.yml + parameters: + platform: ubuntu - job: 'Windows_Test' pool: @@ -35,6 +37,8 @@ jobs: steps: - template: ci/azure-pipelines-steps.yml + parameters: + platform: windows - job: 'macOS_Test' pool: @@ -49,3 +53,5 @@ jobs: steps: - template: ci/azure-pipelines-steps.yml + parameters: + platform: macos diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml index fbc12d81878b..49a1086ed5a3 100644 --- a/ci/azure-pipelines-steps.yml +++ b/ci/azure-pipelines-steps.yml @@ -1,3 +1,6 @@ +parameters: + platform: none + steps: - task: UsePythonVersion@0 inputs: @@ -13,12 +16,43 @@ steps: # prerelease: true # condition: and(succeeded(), eq(variables['python.version'], 'Pre')) + +- ${{ if eq(parameters.platform, 'macos') }}: + - script: | + brew install pkg-config ffmpeg imagemagick mplayer ccache + displayName: 'Install dependencies with brew' + +- ${{ if eq(parameters.platform, 'ubuntu') }}: + - 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' + displayName: 'Install dependencies with pip' - script: | From 54227e8edc77f6dc1b2b097d1bcef9e19513b606 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Dec 2018 08:55:13 -0800 Subject: [PATCH 05/12] Attempt to use libpng from nuget for Windows build --- ci/azure-pipelines-steps.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml index 49a1086ed5a3..d7c80c0203b6 100644 --- a/ci/azure-pipelines-steps.yml +++ b/ci/azure-pipelines-steps.yml @@ -9,13 +9,18 @@ steps: displayName: 'Use Python $(python.version)' condition: and(succeeded(), ne(variables['python.version'], 'Pre')) -# Disabled until extension is added -#- task: stevedower.python.InstallPython.InstallPython@1 -# displayName: 'Use prerelease Python' -# inputs: -# prerelease: true -# condition: and(succeeded(), eq(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.platform, 'windows') }}: + - script: | + nuget install libpng-msvc14-x64 -ExcludeVersion -OutputDirectory "$(build.BinariesDirectory)" + echo ##vso[task.setvariable variable=MPLBASEDIRLIST]win32_static;$(build.BinariesDirectory)\libpng-msvc14-x64\build\native + echo ##vso[task.setvariable variable=LIBDIR]%LIBDIR%;$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\lib_release + echo ##vso[task.prependpath]$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\bin_release - ${{ if eq(parameters.platform, 'macos') }}: - script: | From a722fbad1eedd982697bd140ccbba7ce3efd57e7 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Dec 2018 09:17:55 -0800 Subject: [PATCH 06/12] Ensures nuget is available on PATH --- azure-pipelines.yml | 8 +++++--- ci/azure-pipelines-steps.yml | 11 ++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b9081d2620fe..1b71826d38f3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,7 @@ jobs: - template: ci/azure-pipelines-steps.yml parameters: platform: ubuntu + installer: apt - job: 'Windows_Test' pool: @@ -30,15 +31,15 @@ jobs: python.version: '3.6' Python37: python.version: '3.7' - # Disabled until a required extension is installed - #PythonPreview: - # python.version: 'Pre' + PythonPreview: + python.version: 'Pre' maxParallel: 4 steps: - template: ci/azure-pipelines-steps.yml parameters: platform: windows + installer: nuget - job: 'macOS_Test' pool: @@ -55,3 +56,4 @@ jobs: - template: ci/azure-pipelines-steps.yml parameters: platform: macos + installer: brew diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml index d7c80c0203b6..ddc577500fcb 100644 --- a/ci/azure-pipelines-steps.yml +++ b/ci/azure-pipelines-steps.yml @@ -1,5 +1,6 @@ parameters: platform: none + installer: none steps: - task: UsePythonVersion@0 @@ -15,19 +16,23 @@ steps: prerelease: true condition: and(succeeded(), eq(variables['python.version'], 'Pre')) -- ${{ if eq(parameters.platform, 'windows') }}: +- ${{ if eq(parameters.installer, 'nuget') }}: + - task: NuGetToolInstaller@0 + displayName: 'Use latest available Nuget' + - script: | nuget install libpng-msvc14-x64 -ExcludeVersion -OutputDirectory "$(build.BinariesDirectory)" echo ##vso[task.setvariable variable=MPLBASEDIRLIST]win32_static;$(build.BinariesDirectory)\libpng-msvc14-x64\build\native echo ##vso[task.setvariable variable=LIBDIR]%LIBDIR%;$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\lib_release echo ##vso[task.prependpath]$(build.BinariesDirectory)\libpng-msvc14-x64\build\native\bin_release + displayName: 'Install dependencies with nuget' -- ${{ if eq(parameters.platform, 'macos') }}: +- ${{ if eq(parameters.installer, 'brew') }}: - script: | brew install pkg-config ffmpeg imagemagick mplayer ccache displayName: 'Install dependencies with brew' -- ${{ if eq(parameters.platform, 'ubuntu') }}: +- ${{ if eq(parameters.installer, 'apt') }}: - script: | sudo apt-add-repository ppa:jonathonf/ffmpeg-3 sudo apt-get update From c0ec162df60cdeceb87f59221fd699b091134b74 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Dec 2018 22:17:59 -0500 Subject: [PATCH 07/12] CI: blindly try to change to vs14 and see what happens... --- setupext.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setupext.py b/setupext.py index d5f4b81f5621..b5c67bcec2a5 100644 --- a/setupext.py +++ b/setupext.py @@ -1009,12 +1009,10 @@ def do_custom_build(self): """ import distutils.msvc9compiler as msvc # Note: freetype has no build profile for 2014, so we don't bother... - vc = 'vc2010' + vc = 'vc2014' WinXX = 'x64' if platform.architecture()[0] == '64bit' else 'Win32' xXX = 'x64' if platform.architecture()[0] == '64bit' else 'x86' - vcvarsall = msvc.find_vcvarsall(10.0) - if vcvarsall is None: - raise RuntimeError('Microsoft VS 2010 required') + vcvarsall = msvc.find_vcvarsall(14.0) cmdfile = pathlib.Path("build/build_freetype.cmd") cmdfile.write_text(FREETYPE_BUILD_CMD.format( vc20xx=vc, WinXX=WinXX, xXX=xXX, vcvarsall=vcvarsall)) From 937ba23f56293f815eae5cdca9f70fd4f0ea0ccc Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Dec 2018 22:24:40 -0500 Subject: [PATCH 08/12] TST: add debugging prints for bad font parsing --- lib/matplotlib/font_manager.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index cdf3d7b85dae..e713deefa865 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -1191,13 +1191,17 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default, continue # Matching family should have highest priority, so it is multiplied # by 10.0 - score = \ - self.score_family(prop.get_family(), font.name) * 10.0 + \ - self.score_style(prop.get_style(), font.style) + \ - self.score_variant(prop.get_variant(), font.variant) + \ - self.score_weight(prop.get_weight(), font.weight) + \ - self.score_stretch(prop.get_stretch(), font.stretch) + \ - self.score_size(prop.get_size(), font.size) + try: + score = \ + self.score_family(prop.get_family(), font.name) * 10.0 + \ + self.score_style(prop.get_style(), font.style) + \ + self.score_variant(prop.get_variant(), font.variant) + \ + self.score_weight(prop.get_weight(), font.weight) + \ + self.score_stretch(prop.get_stretch(), font.stretch) + \ + self.score_size(prop.get_size(), font.size) + except KeyError: + print('*'*30, font.fname, '*'*30) + raise if score < best_score: best_score = score best_font = font From abc8c030d5eeccc5dd8bd5e7da6e6f548c374a73 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Dec 2018 22:47:39 -0500 Subject: [PATCH 09/12] FIX: logic error where we only check the freetype hash on download There was an extra layer of indentation. --- setupext.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setupext.py b/setupext.py index b5c67bcec2a5..67e66dcbdae9 100644 --- a/setupext.py +++ b/setupext.py @@ -978,9 +978,9 @@ def do_custom_build(self): # If this fails, we can always re-download. pass - if get_file_hash(tarball_path) != LOCAL_FREETYPE_HASH: - raise IOError( - "{} does not match expected hash.".format(tarball)) + if get_file_hash(tarball_path) != LOCAL_FREETYPE_HASH: + raise IOError( + "{} does not match expected hash.".format(tarball)) print("Building {}".format(tarball)) with tarfile.open(tarball_path, "r:gz") as tgz: From ba8141b8e11237ee56bb55b9ca06a8a9b4c3c823 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Dec 2018 22:51:05 -0500 Subject: [PATCH 10/12] MNT: add hashes for freetype 2.9 and 2.9.1 --- setupext.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setupext.py b/setupext.py index 67e66dcbdae9..0b3d70fa616e 100644 --- a/setupext.py +++ b/setupext.py @@ -47,6 +47,8 @@ def _get_xdg_cache_dir(): '2.7.1': '162ef25aa64480b1189cdb261228e6c5c44f212aac4b4621e28cf2157efb59f5', '2.8': '33a28fabac471891d0523033e99c0005b95e5618dc8ffa7fa47f9dadcacb1c9b', '2.8.1': '876711d064a6a1bd74beb18dd37f219af26100f72daaebd2d86cb493d7cd7ec6', + '2.9': 'bf380e4d7c4f3b5b1c1a7b2bf3abb967bda5e9ab480d0df656e0e08c5019c5e6', + '2.9.1': 'ec391504e55498adceb30baceebd147a6e963f636eb617424bcfc47a169898ce', } # This is the version of FreeType to use when building a local # version. It must match the value in From d436f94ea9514c9cf4f45aa8e5470930e105d7e7 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Dec 2018 22:59:12 -0500 Subject: [PATCH 11/12] CI: bump to freetype 2.9.1 on windows Expect this to fail tests, but trying to get it to build. --- setupext.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setupext.py b/setupext.py index 0b3d70fa616e..5432b1d9f625 100644 --- a/setupext.py +++ b/setupext.py @@ -54,7 +54,10 @@ def _get_xdg_cache_dir(): # version. It must match the value in # lib/matplotlib.__init__.py and also needs to be changed below in the # embedded windows build script (grep for "REMINDER" in this file) -LOCAL_FREETYPE_VERSION = '2.6.1' +if sys.platform == 'win32': + LOCAL_FREETYPE_VERSION = '2.9.1' +else: + LOCAL_FREETYPE_VERSION = '2.6.1' LOCAL_FREETYPE_HASH = _freetype_hashes.get(LOCAL_FREETYPE_VERSION, 'unknown') From 4a222bf0725d3abed4e6ed6739396335a0eaf499 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Dec 2018 23:19:29 -0500 Subject: [PATCH 12/12] CI: can we use the freetype from conda on appveyor? --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 50f752a2e47d..e1931db49b9e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -85,7 +85,7 @@ install: - del %LIBRARY_LIB%\z.lib - set MPLBASEDIRLIST=%CONDA_PREFIX%\Library\;. # enables the local freetype build - - set MPLLOCALFREETYPE=1 + # - set MPLLOCALFREETYPE=1 # Show the installed packages + versions - conda list