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 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b3ae38c8a57d..1b71826d38f3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,9 +5,9 @@ jobs: -- job: 'Test' +- job: 'Linux_Test' pool: - vmImage: 'Ubuntu 16.04' + vmImage: ubuntu-16.04 strategy: matrix: Python36: @@ -17,35 +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 - pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 - 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 diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml new file mode 100644 index 000000000000..ddc577500fcb --- /dev/null +++ b/ci/azure-pipelines-steps.yml @@ -0,0 +1,87 @@ +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)" + 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.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' + +- task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test-results.xml' + testRunTitle: 'Python $(python.version)' + condition: succeededOrFailed() 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 diff --git a/setupext.py b/setupext.py index d5f4b81f5621..5432b1d9f625 100644 --- a/setupext.py +++ b/setupext.py @@ -47,12 +47,17 @@ 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 # 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') @@ -978,9 +983,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: @@ -1009,12 +1014,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))