##// END OF EJS Templates
Mac OSX support for svg converter
Jonathan Frederic -
Show More
@@ -23,7 +23,8 b' from .convertfigures import ConvertFiguresTransformer'
23 23 # Constants
24 24 #-----------------------------------------------------------------------------
25 25
26 INKSCAPE_COMMAND = "inkscape --without-gui --export-pdf=\"{to_filename}\" \"{from_filename}\""
26 INKSCAPE_COMMAND = 'inkscape --without-gui --export-pdf="{to_filename}" "{from_filename}"'
27 INKSCAPE_OSX_COMMAND = '/Applications/Inkscape.app/Contents/Resources/bin/inkscape --without-gui --export-pdf="{to_filename}" "{from_filename}"'
27 28
28 29
29 30 #-----------------------------------------------------------------------------
@@ -56,9 +57,14 b' class ConvertSvgTransformer(ConvertFiguresTransformer):'
56 57 with open(input_filename, 'w') as f:
57 58 f.write(data)
58 59
60 #Determine command (different on Mac OSX)
61 command = INKSCAPE_COMMAND
62 if sys.platform == 'darwin':
63 command = INKSCAPE_OSX_COMMAND
64
59 65 #Call conversion application
60 66 output_filename = os.path.join(tmpdir, 'figure.pdf')
61 shell = INKSCAPE_COMMAND.format(from_filename=input_filename,
67 shell = command.format(from_filename=input_filename,
62 68 to_filename=output_filename)
63 69 subprocess.call(shell, shell=True) #Shell=True okay since input is trusted.
64 70
General Comments 0
You need to be logged in to leave comments. Login now