# Full author contact details are available in file CREDITS.
from __future__ import print_function
-import glob, logging, os, re, shutil, subprocess, sys, stat
+import glob, logging, os, errno, re, shutil, subprocess, sys, stat
# set up logging
logging.basicConfig(level = logging.DEBUG,
try:
os.remove(file)
logger.debug('Removing file %s' % file)
- except:
- logger.debug('Failed to remove file %s' % file)
+ except OSError as e:
+ if e.errno == errno.ENOENT: # no such file or directory
+ logger.debug('No need to remove file %s (it does not exists)' % file)
+ elif e.errno == errno.EISDIR: # is a directory
+ logger.debug('Failed to remove file %s (it is a directory)' % file)
+ else:
+ logger.debug('Failed to remove file %s' % file)
pass
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
return False
+texteditors = ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate',
+ 'nedit', 'gedit', 'geany', 'leafpad', 'mousepad',
+ 'xed', 'notepad', 'WinEdt', 'WinShell', 'PSPad']
+
def checkFormatEntries(dtl_tools):
''' Check all formats (\Format entries) '''
checkViewerEditor('a Tgif viewer and editor', ['tgif'],
['gimp-remote', 'gimp'], rc_entry = [imageformats])
addToRC(imageformats % ((iv, ie)*10))
#
- checkViewerEditor('a text editor',
- ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate',
- 'nedit', 'gedit', 'geany', 'leafpad', 'mousepad', 'xed', 'notepad'],
+ checkViewerEditor('a text editor', texteditors,
rc_entry = [r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%" "" ""
\Format docbook sgml DocBook B "" "%%" "document,menu=export" ""
\Format docbook-xml xml "DocBook (XML)" "" "" "%%" "document,menu=export" "application/docbook+xml"
\Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document,menu=export" ""
\Format literate nw NoWeb N "" "%%" "document,menu=export" ""
\Format sweave Rnw "Sweave" S "" "%%" "document,menu=export" ""
+\Format sweave-ja Rnw "Sweave (Japanese)" S "" "%%" "document,menu=export" ""
\Format r R "R/S code" "" "" "%%" "document,menu=export" ""
\Format knitr Rnw "Rnw (knitr)" "" "" "%%" "document,menu=export" ""
-\Format lilypond ly "LilyPond music" "" "" "%%" "vector" "text/x-lilypond"
+\Format knitr-ja Rnw "Rnw (knitr, Japanese)" "" "" "%%" "document,menu=export" ""
\Format lilypond-book lytex "LilyPond book (LaTeX)" "" "" "%%" "document,menu=export" ""
+\Format lilypond-book-ja lytex "LilyPond book (pLaTeX)" "" "" "%%" "document,menu=export" ""
\Format latex tex "LaTeX (plain)" L "" "%%" "document,menu=export" "text/x-tex"
\Format luatex tex "LaTeX (LuaTeX)" "" "" "%%" "document,menu=export" ""
\Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document,menu=export" ""
\Format text4 txt "Plain text (catdvi)" "" "" "%%" "document" ""
\Format textparagraph txt "Plain Text, Join Lines" "" "" "%%" "document" ""
\Format beamer.info pdf.info "Info (Beamer)" "" "" "%%" "document,menu=export" ""''' ])
+ #Lilypond files have special editors, but fall back to plain text editors
+ checkViewerEditor('a lilypond editor',
+ ['frescobaldi'] + texteditors,
+ rc_entry = [r'''\Format lilypond ly "LilyPond music" "" "" "%%" "vector" "text/x-lilypond"''' ])
#Spreadsheets using ssconvert from gnumeric
checkViewer('gnumeric spreadsheet software', ['gnumeric'],
rc_entry = [r'''\Format gnumeric gnumeric "Gnumeric spreadsheet" "" "" "%%" "document" "application/x-gnumeric"
#
checkEditor('a BibTeX editor', ['jabref', 'JabRef',
'pybliographic', 'bibdesk', 'gbib', 'kbib',
- 'kbibtex', 'sixpack', 'bibedit', 'tkbibtex'
- 'xemacs', 'gvim', 'kedit', 'kwrite', 'kate',
- 'jedit', 'TeXnicCenter', 'WinEdt', 'WinShell', 'PSPad',
- 'nedit', 'gedit', 'notepad', 'geany', 'leafpad', 'mousepad'],
+ 'kbibtex', 'sixpack', 'bibedit', 'tkbibtex', 'TeXnicCenter'] +
+ texteditors,
rc_entry = [r'''\Format bibtex bib "BibTeX" "" "" "%%" "" "text/x-bibtex"''' ])
#
#checkProg('a Postscript interpreter', ['gs'],
checkProg('a Sweave -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxsweave.R $$p$$i $$p$$o $$e $$r'],
rc_entry = [r'''\converter sweave latex "%%" "needauth"
\converter sweave pdflatex "%%" "needauth"
+\converter sweave-ja platex "%%" "needauth"
\converter sweave xetex "%%" "needauth"
\converter sweave luatex "%%" "needauth"
\converter sweave dviluatex "%%" "needauth"'''])
checkProg('a knitr -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r'],
rc_entry = [r'''\converter knitr latex "%%" "needauth"
\converter knitr pdflatex "%%" "needauth"
+\converter knitr-ja platex "%%" "needauth"
\converter knitr xetex "%%" "needauth"
\converter knitr luatex "%%" "needauth"
\converter knitr dviluatex "%%" "needauth"'''])
#
checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'],
- rc_entry = [ r'\converter sweave r "%%" "needauth"' ])
+ rc_entry = [ r'\converter sweave r "%%" "needauth"',
+ r'\converter sweave-ja r "%%" "needauth"' ])
#
checkProg('a knitr -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r tangle'],
- rc_entry = [ r'\converter knitr r "%%" "needauth"' ])
+ rc_entry = [ r'\converter knitr r "%%" "needauth"',
+ r'\converter knitr-ja r "%%" "needauth"' ])
#
checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex',
'htmltolatex -input $$i -output $$o', 'htmltolatex.jar -input $$i -output $$o'],
\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'],
\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'],
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])
# this, use different output folders for eps and pdf outputs.
addToRC(r'\converter lilypond-book latex "lilypond-book --safe --lily-output-dir=ly-eps $$i" ""')
addToRC(r'\converter lilypond-book pdflatex "lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$i" ""')
+ addToRC(r'\converter lilypond-book-ja platex "lilypond-book --safe --pdf --latex-program=platex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book xetex "lilypond-book --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book luatex "lilypond-book --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$i" ""')
addToRC(r'\converter lilypond-book dviluatex "lilypond-book --safe --latex-program=dvilualatex --lily-output-dir=ly-eps $$i" ""')
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
- lyxrc_fileformat = 22
+ lyxrc_fileformat = 24
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''