1111import shutil
1212import subprocess
1313import sys
14- from tempfile import TemporaryDirectory , TemporaryFile
14+ from tempfile import TemporaryDirectory
1515import weakref
1616import re
1717
@@ -146,8 +146,7 @@ def encode_and_escape(name):
146146
147147class _SVGConverter (_Converter ):
148148 def __call__ (self , orig , dest ):
149- old_inkscape = mpl ._get_executable_info ("inkscape" ).version .major < 1
150- terminator = b"\n >" if old_inkscape else b"> "
149+ terminator = b"> "
151150 if not hasattr (self , "_tmpdir" ):
152151 self ._tmpdir = TemporaryDirectory ()
153152 # On Windows, we must make sure that self._proc has terminated
@@ -171,18 +170,10 @@ def __call__(self, orig, dest):
171170 # Do not load any user options.
172171 "INKSCAPE_PROFILE_DIR" : self ._tmpdir .name ,
173172 }
174- # Old versions of Inkscape (e.g. 0.48.3.1) seem to sometimes
175- # deadlock when stderr is redirected to a pipe, so we redirect it
176- # to a temporary file instead. This is not necessary anymore as of
177- # Inkscape 0.92.1.
178- stderr = TemporaryFile ()
179173 self ._proc = subprocess .Popen (
180- ["inkscape" , "--without-gui" , "--shell" ] if old_inkscape else
181174 ["inkscape" , "--shell" ],
182- stdin = subprocess .PIPE , stdout = subprocess .PIPE , stderr = stderr ,
175+ stdin = subprocess .PIPE , stdout = subprocess .PIPE , stderr = subprocess . PIPE ,
183176 env = env , cwd = self ._tmpdir .name )
184- # Slight abuse, but makes shutdown handling easier.
185- self ._proc .stderr = stderr
186177 try :
187178 self ._read_until (terminator )
188179 except _ConverterError as err :
@@ -200,7 +191,6 @@ def __call__(self, orig, dest):
200191 except OSError :
201192 shutil .copyfile (orig , inkscape_orig )
202193 self ._proc .stdin .write (
203- b"f.svg --export-png=f.png\n " if old_inkscape else
204194 b"file-open:f.svg;export-filename:f.png;export-do;file-close\n " )
205195 self ._proc .stdin .flush ()
206196 try :
0 commit comments