add inkscape wrapper script for Mac OS

The wrapper script is placed in the binary directory of the LyX bundle.
It tries to find the real inkscape command line converter in the
Inkscape.app bundle and starts it or reports an error.
The configure.py is changed for Mac OS to check the presence of
the real inkscape binary in the Inkscape.app bundle.
This commit is contained in:
Stephan Witt 2017-09-24 11:54:55 +02:00
parent b498646b2e
commit 350ef993e5
3 changed files with 34 additions and 10 deletions

View File

@ -8,7 +8,7 @@ bundledir = ${prefix}/Contents
dist_bundle_DATA = PkgInfo
nodist_bundle_DATA = Info.plist
dist_bin_SCRIPTS = lyxeditor maxima
dist_bin_SCRIPTS = lyxeditor maxima inkscape
dist_pkgdata_DATA = COPYING LyXapp.icns LyX.icns LyX.sdef dmg-background.png
nodist_pkgdata_DATA = lyxrc.dist

15
development/MacOSX/inkscape Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
unset DISPLAY
# at first try the well known location
RESDIR="/Applications/Inkscape.app/Contents/Resources"
test -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape && exec "${RESDIR}"/bin/inkscape --without-gui "$@"
# this failed... so try PATH expansion to start the inkscape shell wrapper
IFS=":" read -ra DIRLIST <<< "${PATH}"
for BINDIR in "${DIRLIST[@]}" ; do
RESDIR=$(dirname "${BINDIR}")
test -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape && exec "${RESDIR}"/bin/inkscape --without-gui "$@"
done
# report error and exit with failure status
exec 1>&2
echo Could not find Inkscape binary.
exit 1

View File

@ -494,7 +494,16 @@ def checkDTLtools():
def checkInkscape():
''' Check whether Inkscape is available and return the full path (Windows only) '''
if os.name != 'nt':
''' On Mac OS (darwin) a wrapper is used - therefore the version is checked '''
''' The answer of the real inkscape is validated and a fake binary used if this fails '''
if sys.platform == 'darwin':
version_string = cmdOutput("inkscape --version")
match = re.match('^Inkscape', version_string)
if match:
return 'inkscape'
else:
return 'inkscape-binary'
elif os.name != 'nt':
return 'inkscape'
if sys.version_info[0] < 3:
import _winreg as winreg
@ -981,11 +990,11 @@ def checkConverterEntries():
\converter fig pstex "python -tt $$s/scripts/fig2pstex.py $$i $$o" ""''')
#
checkProg('a SVG -> PDFTeX converter', [inkscape_name],
rc_entry = [ r'\converter svg pdftex "python -tt $$s/scripts/svg2pdftex.py %% $$i $$o" ""'],
rc_entry = [ r'\converter svg pdftex "python -tt $$s/scripts/svg2pdftex.py %% $$p$$i $$p$$o" ""'],
path = [inkscape_path])
#
checkProg('a SVG -> PSTeX converter', [inkscape_name],
rc_entry = [ r'\converter svg pstex "python -tt $$s/scripts/svg2pstex.py %% $$i $$o" ""'],
rc_entry = [ r'\converter svg pstex "python -tt $$s/scripts/svg2pstex.py %% $$p$$i $$p$$o" ""'],
path = [inkscape_path])
#
checkProg('a TIFF -> PS converter', ['tiff2ps $$i > $$o'],
@ -997,16 +1006,16 @@ def checkConverterEntries():
\converter tgif png "tgif -print -color -png -o $$d $$i" ""
\converter tgif pdf6 "tgif -print -color -pdf -stdout $$i > $$o" ""'''])
#
checkProg('a WMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i', inkscape_name + ' --file=$$i --export-area-drawing --without-gui --export-eps=$$o'],
checkProg('a WMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i', inkscape_name + ' --file=$$p$$i --export-area-drawing --without-gui --export-eps=$$p$$o'],
rc_entry = [ r'\converter wmf eps "%%" ""'])
#
checkProg('an EMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i', inkscape_name + ' --file=$$i --export-area-drawing --without-gui --export-eps=$$o'],
checkProg('an EMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i', inkscape_name + ' --file=$$p$$i --export-area-drawing --without-gui --export-eps=$$p$$o'],
rc_entry = [ r'\converter emf eps "%%" ""'])
#
checkProg('a WMF -> PDF converter', [inkscape_name + ' --file=$$i --export-area-drawing --without-gui --export-pdf=$$o'],
checkProg('a WMF -> PDF converter', [inkscape_name + ' --file=$$p$$i --export-area-drawing --without-gui --export-pdf=$$p$$o'],
rc_entry = [ r'\converter wmf pdf6 "%%" ""'])
#
checkProg('an EMF -> PDF converter', [inkscape_name + ' --file=$$i --export-area-drawing --without-gui --export-pdf=$$o'],
checkProg('an EMF -> PDF converter', [inkscape_name + ' --file=$$p$$i --export-area-drawing --without-gui --export-pdf=$$p$$o'],
rc_entry = [ r'\converter emf pdf6 "%%" ""'])
# Only define a converter to pdf6 for graphics
checkProg('an EPS -> PDF converter', ['epstopdf'],
@ -1052,12 +1061,12 @@ def checkConverterEntries():
rc_entry = [ r'\converter svg svgz "%%" ""'])
# Only define a converter to pdf6 for graphics
# Prefer rsvg-convert over inkscape since it is faster (see http://www.lyx.org/trac/ticket/9891)
checkProg('a SVG -> PDF converter', ['rsvg-convert -f pdf -o $$o $$i', inkscape_name + ' --file=$$i --export-area-drawing --without-gui --export-pdf=$$o'],
checkProg('a SVG -> PDF converter', ['rsvg-convert -f pdf -o $$o $$i', inkscape_name + ' --file=$$p$$i --export-area-drawing --without-gui --export-pdf=$$p$$o'],
rc_entry = [ r'''\converter svg pdf6 "%%" ""
\converter svgz pdf6 "%%" ""'''],
path = ['', inkscape_path])
#
checkProg('a SVG -> EPS converter', ['rsvg-convert -f ps -o $$o $$i', inkscape_name + ' --file=$$i --export-area-drawing --without-gui --export-eps=$$o'],
checkProg('a SVG -> EPS converter', ['rsvg-convert -f ps -o $$o $$i', inkscape_name + ' --file=$$p$$i --export-area-drawing --without-gui --export-eps=$$p$$o'],
rc_entry = [ r'''\converter svg eps "%%" ""
\converter svgz eps "%%" ""'''],
path = ['', inkscape_path])