diff --git a/doc/sphinxext/redirect_from.py b/doc/sphinxext/redirect_from.py index 34f00bf45cb9..555ba129002c 100644 --- a/doc/sphinxext/redirect_from.py +++ b/doc/sphinxext/redirect_from.py @@ -15,6 +15,7 @@ This creates in the build directory a file ``build/html/topic/old-page.html`` that contains a relative refresh:: +
@@ -38,7 +39,9 @@ logger = logging.getLogger(__name__) -HTML_TEMPLATE = """ +HTML_TEMPLATE = """\ + + @@ -115,4 +118,4 @@ def _generate_redirects(app, exception): else: logger.info(f'making refresh html file: {k} redirect to {v}') p.parent.mkdir(parents=True, exist_ok=True) - p.write_text(html) + p.write_text(html, encoding='utf-8') diff --git a/lib/matplotlib/testing/__init__.py b/lib/matplotlib/testing/__init__.py index eba878e0a4a3..43e215e7f994 100644 --- a/lib/matplotlib/testing/__init__.py +++ b/lib/matplotlib/testing/__init__.py @@ -108,7 +108,7 @@ def _check_for_pgf(texsystem): \typeout{pgfversion=\pgfversion} \makeatletter \@@end - """) + """, encoding="utf-8") try: subprocess.check_call( [texsystem, "-halt-on-error", str(tex_path)], cwd=tmpdir, diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index ffa06964e839..3aab1fd7c190 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -288,9 +288,8 @@ def test_failing_ffmpeg(tmpdir, monkeypatch, anim): with tmpdir.as_cwd(): monkeypatch.setenv("PATH", ".:" + os.environ["PATH"]) exe_path = Path(str(tmpdir), "ffmpeg") - exe_path.write_text("#!/bin/sh\n" - "[[ $@ -eq 0 ]]\n") - os.chmod(str(exe_path), 0o755) + exe_path.write_bytes(b"#!/bin/sh\n[[ $@ -eq 0 ]]\n") + os.chmod(exe_path, 0o755) with pytest.raises(subprocess.CalledProcessError): anim.save("test.mpeg") diff --git a/lib/matplotlib/tests/test_sphinxext.py b/lib/matplotlib/tests/test_sphinxext.py index f71c6e32018a..d4fb94ade5d1 100644 --- a/lib/matplotlib/tests/test_sphinxext.py +++ b/lib/matplotlib/tests/test_sphinxext.py @@ -75,9 +75,9 @@ def plot_directive_file(num): assert filecmp.cmp(range_6, plot_file(17)) # Modify the included plot - contents = (source_dir / 'included_plot_21.rst').read_text() - contents = contents.replace('plt.plot(range(6))', 'plt.plot(range(4))') - (source_dir / 'included_plot_21.rst').write_text(contents) + contents = (source_dir / 'included_plot_21.rst').read_bytes() + contents = contents.replace(b'plt.plot(range(6))', b'plt.plot(range(4))') + (source_dir / 'included_plot_21.rst').write_bytes(contents) # Build the pages again and check that the modified file was updated modification_times = [plot_directive_file(i).stat().st_mtime for i in (1, 2, 3, 5)] diff --git a/setupext.py b/setupext.py index e68bacdedcb1..2b1fd9349c07 100644 --- a/setupext.py +++ b/setupext.py @@ -668,6 +668,7 @@ def do_custom_build(self, env): sln_path = base_path / vc / "freetype.sln" # https://developercommunity.visualstudio.com/comments/190992/view.html (sln_path.parent / "Directory.Build.props").write_text( + "" "