Skip to content

Commit b9354da

Browse files
authored
Merge branch 'master' into mpl_toolkits-locators
2 parents 8ecfb2e + 1e9c794 commit b9354da

File tree

13 files changed

+159
-159
lines changed

13 files changed

+159
-159
lines changed

INSTALL.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ etc., you can install the following:
150150
* `ImageMagick <https://www.imagemagick.org/script/index.php>`_: for saving
151151
animated gifs;
152152
* `LaTeX <https://miktex.org/>`_ and `GhostScript (>=9.0)
153-
<https://ghostscript.com/download/>`_ : for rendering text with LaTeX.
153+
<https://ghostscript.com/download/>`_ : for rendering text with LaTeX;
154+
* `fontconfig <https://www.fontconfig.org>`_ (>= 2.7): for detection of system
155+
fonts on Linux.
154156

155157
FreeType and Qhull
156158
------------------

azure-pipelines.yml

Lines changed: 104 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,107 @@
33
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
44
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
55

6-
jobs:
7-
8-
- job: 'Linux_Test'
9-
pool:
10-
vmImage: ubuntu-16.04
11-
strategy:
12-
matrix:
13-
Python36:
14-
python.version: '3.6'
15-
Python37:
16-
python.version: '3.7'
17-
maxParallel: 4
18-
19-
steps:
20-
- template: ci/azure-pipelines-steps.yml
21-
parameters:
22-
platform: ubuntu
23-
installer: apt
24-
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
37-
38-
steps:
39-
- template: ci/azure-pipelines-steps.yml
40-
parameters:
41-
platform: windows
42-
installer: nuget
43-
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
54-
55-
steps:
56-
- template: ci/azure-pipelines-steps.yml
57-
parameters:
58-
platform: macos
59-
installer: brew
6+
strategy:
7+
matrix:
8+
Linux_py36:
9+
vmImage: 'ubuntu-16.04'
10+
python.version: '3.6'
11+
Linux_py37:
12+
vmImage: 'ubuntu-16.04'
13+
python.version: '3.7'
14+
macOS_py36:
15+
vmImage: 'xcode9-macOS10.13'
16+
python.version: '3.6'
17+
macOS_py37:
18+
vmImage: 'xcode9-macOS10.13'
19+
python.version: '3.7'
20+
Windows_py36:
21+
vmImage: 'vs2017-win2016'
22+
python.version: '3.6'
23+
Windows_py37:
24+
vmImage: 'vs2017-win2016'
25+
python.version: '3.7'
26+
Windows_pyPre:
27+
vmImage: 'vs2017-win2016'
28+
python.version: 'Pre'
29+
maxParallel: 4
30+
31+
pool:
32+
vmImage: '$(vmImage)'
33+
34+
steps:
35+
36+
- task: UsePythonVersion@0
37+
inputs:
38+
versionSpec: '$(python.version)'
39+
architecture: 'x64'
40+
displayName: 'Use Python $(python.version)'
41+
condition: and(succeeded(), ne(variables['python.version'], 'Pre'))
42+
43+
- task: stevedower.python.InstallPython.InstallPython@1
44+
displayName: 'Use prerelease Python'
45+
inputs:
46+
prerelease: true
47+
condition: and(succeeded(), eq(variables['python.version'], 'Pre'))
48+
49+
- bash: |
50+
case "$(python -c 'import sys; print(sys.platform)')" in
51+
linux)
52+
sudo apt-add-repository ppa:jonathonf/ffmpeg-3
53+
sudo apt-get update
54+
sudo apt-get install \
55+
cm-super \
56+
dvipng \
57+
ffmpeg \
58+
gdb \
59+
gir1.2-gtk-3.0 \
60+
graphviz \
61+
inkscape \
62+
libcairo2 \
63+
libgeos-dev \
64+
libgirepository-1.0.1 \
65+
lmodern \
66+
otf-freefont \
67+
pgf \
68+
texlive-fonts-recommended \
69+
texlive-latex-base \
70+
texlive-latex-extra \
71+
texlive-latex-recommended \
72+
texlive-xetex texlive-luatex
73+
;;
74+
darwin)
75+
brew cask install xquartz
76+
brew install pkg-config ffmpeg imagemagick mplayer ccache
77+
;;
78+
win32)
79+
;;
80+
*)
81+
exit 1
82+
;;
83+
esac
84+
displayName: 'Install dependencies'
85+
86+
- bash: |
87+
python -m pip install --upgrade pip
88+
python -m pip install -r requirements/testing/travis_all.txt -r requirements/testing/travis36.txt ||
89+
[[ "$PYTHON_VERSION" = 'Pre' ]]
90+
displayName: 'Install dependencies with pip'
91+
92+
- bash: |
93+
python -m pip install -ve . ||
94+
[[ "$PYTHON_VERSION" = 'Pre' ]]
95+
displayName: "Install self"
96+
97+
- script: env
98+
displayName: 'print env'
99+
100+
- bash: |
101+
PYTHONFAULTHANDLER=1 python -m pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 ||
102+
[[ "$PYTHON_VERSION" = 'Pre' ]]
103+
displayName: 'pytest'
104+
105+
- task: PublishTestResults@2
106+
inputs:
107+
testResultsFiles: '**/test-results.xml'
108+
testRunTitle: 'Python $(python.version)'
109+
condition: succeededOrFailed()

ci/azure-pipelines-steps.yml

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

doc/api/next_api_changes/behaviour.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ did nothing, when passed an unsupported value. It now raises a ``ValueError``.
3636
`.Axis.set_tick_params` (and the higher level `.axes.Axes.tick_params` and
3737
`.pyplot.tick_params`) used to accept any value for ``which`` and silently
3838
did nothing, when passed an unsupported value. It now raises a ``ValueError``.
39+
40+
``backend_pgf.LatexManager.latex``
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42+
``backend_pgf.LatexManager.latex`` is now created with ``encoding="utf-8"``, so
43+
its ``stdin``, ``stdout``, and ``stderr`` attributes are utf8-encoded.

doc/api/next_api_changes/deprecations.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ with locator classes defined in :mod:`matplotlib.ticker`.
3434
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3535
The ``set_factor`` method of :mod:`mpl_toolkits.axisartist` locators (which are
3636
different from "standard" Matplotlib tick locators) is deprecated.
37+
38+
``backend_pgf.LatexManager.latex_stdin_utf8``
39+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40+
``backend_pgf.LatexManager.latex`` is now created with ``encoding="utf-8"``, so
41+
its ``stdin`` attribute is already utf8-encoded; the ``latex_stdin_utf8``
42+
attribute is thus deprecated.
43+

examples/animation/dynamic_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def f(x, y):
3636
#
3737
# or
3838
#
39-
# from matplotlib.animation import FFMpegWriter
40-
# writer = FFMpegWriter(fps=15, metadata=dict(artist='Me'), bitrate=1800)
39+
# writer = animation.FFMpegWriter(
40+
# fps=15, metadata=dict(artist='Me'), bitrate=1800)
4141
# ani.save("movie.mp4", writer=writer)
4242

4343
plt.show()

examples/animation/simple_anim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def animate(i):
3434
#
3535
# or
3636
#
37-
# from matplotlib.animation import FFMpegWriter
38-
# writer = FFMpegWriter(fps=15, metadata=dict(artist='Me'), bitrate=1800)
37+
# writer = animation.FFMpegWriter(
38+
# fps=15, metadata=dict(artist='Me'), bitrate=1800)
3939
# ani.save("movie.mp4", writer=writer)
4040

4141
plt.show()

lib/matplotlib/backends/backend_pgf.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,21 @@ def _cleanup_remaining_instances():
254254
latex_manager._cleanup()
255255

256256
def _stdin_writeln(self, s):
257-
self.latex_stdin_utf8.write(s)
258-
self.latex_stdin_utf8.write("\n")
259-
self.latex_stdin_utf8.flush()
257+
self.latex.stdin.write(s)
258+
self.latex.stdin.write("\n")
259+
self.latex.stdin.flush()
260260

261261
def _expect(self, s):
262-
exp = s.encode("utf8")
263-
buf = bytearray()
262+
s = list(s)
263+
chars = []
264264
while True:
265-
b = self.latex.stdout.read(1)
266-
buf += b
267-
if buf[-len(exp):] == exp:
265+
c = self.latex.stdout.read(1)
266+
chars.append(c)
267+
if chars[-len(s):] == s:
268268
break
269-
if not len(b):
270-
raise LatexError("LaTeX process halted", buf.decode("utf8"))
271-
return buf.decode("utf8")
269+
if not c:
270+
raise LatexError("LaTeX process halted", "".join(chars))
271+
return "".join(chars)
272272

273273
def _expect_prompt(self):
274274
return self._expect("\n*")
@@ -287,28 +287,27 @@ def __init__(self):
287287
self.latex_header = LatexManager._build_latex_header()
288288
latex_end = "\n\\makeatletter\n\\@@end\n"
289289
try:
290-
latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
291-
stdin=subprocess.PIPE,
292-
stdout=subprocess.PIPE,
293-
cwd=self.tmpdir)
290+
latex = subprocess.Popen(
291+
[self.texcommand, "-halt-on-error"],
292+
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
293+
encoding="utf-8", cwd=self.tmpdir)
294294
except FileNotFoundError:
295295
raise RuntimeError(
296296
"Latex command not found. Install %r or change "
297297
"pgf.texsystem to the desired command." % self.texcommand)
298298
except OSError:
299299
raise RuntimeError("Error starting process %r" % self.texcommand)
300300
test_input = self.latex_header + latex_end
301-
stdout, stderr = latex.communicate(test_input.encode("utf-8"))
301+
stdout, stderr = latex.communicate(test_input)
302302
if latex.returncode != 0:
303303
raise LatexError("LaTeX returned an error, probably missing font "
304304
"or error in preamble:\n%s" % stdout)
305305

306306
# open LaTeX process for real work
307-
latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
308-
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
309-
cwd=self.tmpdir)
310-
self.latex = latex
311-
self.latex_stdin_utf8 = codecs.getwriter("utf8")(self.latex.stdin)
307+
self.latex = subprocess.Popen(
308+
[self.texcommand, "-halt-on-error"],
309+
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
310+
encoding="utf-8", cwd=self.tmpdir)
312311
# write header with 'pgf_backend_query_start' token
313312
self._stdin_writeln(self._build_latex_header())
314313
# read all lines until our 'pgf_backend_query_start' token appears
@@ -318,13 +317,15 @@ def __init__(self):
318317
# cache for strings already processed
319318
self.str_cache = {}
320319

320+
@cbook.deprecated("3.3")
321+
def latex_stdin_utf8(self):
322+
return self.latex.stdin
323+
321324
def _cleanup(self):
322325
if not self._os_path.isdir(self.tmpdir):
323326
return
324327
try:
325328
self.latex.communicate()
326-
self.latex_stdin_utf8.close()
327-
self.latex.stdout.close()
328329
except Exception:
329330
pass
330331
try:

lib/matplotlib/font_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ def _call_fc_list():
273273
'This may take a moment.'))
274274
timer.start()
275275
try:
276+
if b'--format' not in subprocess.check_output(['fc-list', '--help']):
277+
_log.warning( # fontconfig 2.7 implemented --format.
278+
'Matplotlib needs fontconfig>=2.7 to query system fonts.')
279+
return []
276280
out = subprocess.check_output(['fc-list', '--format=%{file}\\n'])
277281
except (OSError, subprocess.CalledProcessError):
278282
return []

0 commit comments

Comments
 (0)