Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2b7d09

Browse files
committed
Deprecate support for running svg converter from path contaning newline.
Inkscape's batch mode doesn't handle newlines(!) in file names, which tbh doesn't seem to be a too big restriction in practice. Right now we fallback on a specific path to handle that case, but I doubt that it is really hit, given that the batch ghostscript converter likely has the same limitation and no one complained about it for two years.
1 parent 68652b1 commit b2b7d09

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

doc/api/api_changes_3.3/deprecations.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,3 +487,7 @@ of all renderer classes is deprecated.
487487

488488
`.transforms.AffineDeltaTransform` can be used as a replacement. This API is
489489
experimental and may change in the future.
490+
491+
``testing.compare.make_external_conversion_command``
492+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
493+
... is deprecated.

lib/matplotlib/testing/compare.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""
2-
Provides a collection of utilities for comparing (image) results.
3-
2+
Utilities for comparing image results.
43
"""
54

65
import atexit
@@ -17,6 +16,7 @@
1716
import PIL
1817

1918
import matplotlib as mpl
19+
from matplotlib import cbook
2020
from matplotlib.testing.exceptions import ImageComparisonFailure
2121

2222
__all__ = ['compare_images', 'comparable_formats']
@@ -55,6 +55,7 @@ def get_file_hash(path, block_size=2 ** 20):
5555
return md5.hexdigest()
5656

5757

58+
@cbook.deprecated("3.3")
5859
def make_external_conversion_command(cmd):
5960
def convert(old, new):
6061
cmdline = cmd(old, new)
@@ -194,6 +195,10 @@ def __call__(self, orig, dest):
194195
# our encoding is even ASCII compatible... Just fall back on the
195196
# slow solution (Inkscape uses `fgets` so it will always stop at a
196197
# newline).
198+
cbook.warn_deprecated(
199+
"3.3", message="Support for converting files from paths "
200+
"containing a newline is deprecated since %(since)s and "
201+
"support will be removed %(removal)s")
197202
return make_external_conversion_command(lambda old, new: [
198203
'inkscape', '-z', old, '--export-png', new])(orig, dest)
199204
self._proc.stdin.write(orig_b + b" --export-png=" + dest_b + b"\n")

0 commit comments

Comments
 (0)