Skip to content

Commit

Permalink
Merge pull request #1115 from rbeesley/master
Browse files Browse the repository at this point in the history
Update svg2pdf.py to search the PATH for inkscape
  • Loading branch information
MSeal authored Oct 17, 2019
2 parents 945c616 + ae74de3 commit b2250ef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nbconvert/preprocessors/svg2pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

from .convertfigures import ConvertFiguresPreprocessor

if sys.version_info >= (3,3):
from shutil import which
get_inkscape_path = which('inkscape')
else:
get_inkscape_path = None


INKSCAPE_APP = '/Applications/Inkscape.app/Contents/Resources/bin/inkscape'

Expand Down Expand Up @@ -58,6 +64,8 @@ def _command_default(self):
inkscape = Unicode(help="The path to Inkscape, if necessary").tag(config=True)
@default('inkscape')
def _inkscape_default(self):
if get_inkscape_path is not None:
return get_inkscape_path
if sys.platform == "darwin":
if os.path.isfile(INKSCAPE_APP):
return INKSCAPE_APP
Expand Down

0 comments on commit b2250ef

Please sign in to comment.