- # run latex on chklatex.ltx and check result
- if cmdOutput(LATEX + ' chklatex.ltx').find('ThisIsLaTeX2e') != -1:
- lyx_check_config = True
- else:
- print "Latex not usable (not LaTeX2e) "
- # remove temporary files
- removeFiles(['chklatex.ltx', 'chklatex.log'])
-
-checkProg('the pdflatex program', ['pdflatex $$i'],
- rc_entry = [ r'\converter pdflatex pdf2 "%%" "latex"' ])
-
-checkProg('a Tgif viewer and editor', ['tgif'],
- rc_entry = [ r'\Format tgif obj Tgif "" "%%" "%%"'])
-
-checkProg('a FIG viewer and editor', ['xfig'],
- rc_entry = [ r'\Format fig fig FIG "" "%%" "%%"'] )
-
-checkProg('a Grace viewer and editor', ['xmgrace'],
- rc_entry = [ r'\Format agr agr Grace "" "%%" "%%"'] )
-
-checkProg('a FEN viewer and editor', ['xboard -lpf $$i -mode EditPosition'],
- rc_entry = [ r'\Format fen fen FEN "" "%%" "%%"' ])
-
-path, iv = checkProg('a raster image viewer', ['xv', 'kview', 'gimp'])
-path, ie = checkProg('a raster image editor', ['gimp'])
-addToRC(r'''\Format bmp bmp BMP "" "%s" "%s"
-\Format gif gif GIF "" "%s" "%s"
-\Format jpg jpg JPEG "" "%s" "%s"
-\Format pbm pbm PBM "" "%s" "%s"
-\Format pgm pgm PGM "" "%s" "%s"
-\Format png png PNG "" "%s" "%s"
-\Format ppm ppm PPM "" "%s" "%s"
-\Format tiff tif TIFF "" "%s" "%s"
-\Format xbm xbm XBM "" "%s" "%s"
-\Format xpm xpm XPM "" "%s" "%s"''' % \
-(iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie) )
-
-checkProg('a text editor', ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate', \
- 'nedit', 'gedit', 'notepad'],
- rc_entry = [
- r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%"
-\Format asciiimage asc "Plain text (image)" "" "" "%%"
-\Format asciixfig asc "Plain text (Xfig output)" "" "" "%%"
-\Format dateout tmp "date (output)" "" "" "%%"
-\Format docbook sgml DocBook B "" "%%"
-\Format docbook-xml xml "Docbook (XML)" "" "" "%%"
-\Format literate nw NoWeb N "" "%%"
-\Format latex tex "TeX (latex)" l "" "%%"
-\Format linuxdoc sgml LinuxDoc x "" "%%"
-\Format pdflatex tex "TeX (pdflatex)" "" "" "%%"
-\Format text txt "Plain text" a "" "%%"
-\Format textparagraph txt "Plain text (paragraphs)" "" "" "%%"''' ])
-
-checkProg('a LaTeX -> LyX converter', [os.path.join('..','src','tex2lyx','tex2lyx') + ' -f $$i $$o', \
- 'tex2lyx' + version_suffix + ' -f $$i $$o' ],
- rc_entry = [ r'\converter latex lyx "%%" ""' ])
-
-checkProg('a Noweb -> LyX converter', ['noweb2lyx' + version_suffix + ' $$i $$o'], path = ['./reLyX'],
- rc_entry = [ r'\converter literate lyx "%%" ""' ])
-
-checkProg('a Noweb -> LaTeX converter', ['noweave -delay -index $$i > $$o'],
- rc_entry = [ r'\converter literate latex "%%" ""' ])
-
-checkProg('a HTML -> LaTeX converter', ['html2latex $$i'],
- rc_entry = [ r'\converter html latex "%%" ""' ])
-
-checkProg('a MSWord -> LaTeX converter', ['wvCleanLatex $$i $$o'],
- rc_entry = [ r'\converter word latex "%%" ""' ])
-
-checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
- rc_entry = [ r'\converter latex wordhtml "%%" ""' ])
-
-# FIXME: image_command is not used anywhere.
-checkProg('Image converter', ['convert $$i $$o'])
-
-checkProg('an OpenOffice.org -> LaTeX converter', ['w2l -clean $$i'],
- rc_entry = [ r'\converter sxw latex "%%" ""' ])
-
-checkProg('an LaTeX -> OpenOffice.org LaTeX converter', ['oolatex $$i', 'oolatex.sh $$i'],
- rc_entry = [ r'\converter latex sxw "%%" "latex"' ])
-
-#checkProg('a Postscript interpreter', ['gs'],
-# rc_entry = [ r'\ps_command "%%"' ])
-
-checkProg('a Postscript previewer', ['gsview32', 'gv', 'ghostview -swap', 'kghostview'],
- rc_entry = [
- r'''\Format eps eps EPS "" "%%" ""
-\Format ps ps Postscript t "%%" ""''' ])
-
-checkProg('a PDF previewer', ['acrobat', 'acrord32', 'gsview32', \
- 'acroread', 'gv', 'ghostview', 'xpdf', 'kpdf', 'kghostview'],
- rc_entry = [ r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" ""
-\Format pdf2 pdf "PDF (pdflatex)" F "%%" ""
-\Format pdf3 pdf "PDF (dvipdfm)" m "%%" ""''' ])
-
-checkProg('a DVI previewer', ['xdvi', 'windvi', 'yap', 'kdvi'],
- rc_entry = [ r'\Format dvi dvi DVI D "%%" ""' ])
-
-checkProg('a HTML previewer', ['mozilla file://$$p$$i', 'netscape'],
- rc_entry = [ r'\Format html html HTML H "%%" ""' ])
-
-checkProg('a PS to PDF converter', ['ps2pdf13 $$i'],
- rc_entry = [ r'\converter ps pdf "%%" ""' ])
-
-checkProg('a DVI to PS converter', ['dvips -o $$o $$i'],
- rc_entry = [ r'\converter dvi ps "%%" ""' ])
-
-checkProg('a DVI to PDF converter', ['dvipdfm $$i'],
- rc_entry = [ r'\converter dvi pdf3 "%%" ""' ])
-
-### We have a script to convert previewlyx to ppm
-addToRC(r'\converter lyxpreview ppm "python $$s/scripts/lyxpreview2bitmap.py" ""')
-
-path, dvipng = checkProg('dvipng', ['dvipng'])
-if dvipng == "dvipng":
- addToRC(r'\converter lyxpreview png "python $$s/scripts/lyxpreview2bitmap.py" ""')
-else:
- addToRC(r'\converter lyxpreview png "" ""')
-
-checkProg('a *roff formatter', ['groff', 'nroff'],
- rc_entry = [
- r'\ascii_roff_command "groff -t -Tlatin1 $$FName"',
- r'\ascii_roff_command "tbl $$FName | nroff"',
- r'\ascii_roff_command "none"' ])
-
-checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],
- rc_entry = [ r'\chktex_command "%%"' ])
-
-checkProg('a spellchecker', ['ispell'],
- rc_entry = [ r'\spell_command "%%"' ])
-
-## FIXME: OCTAVE is not used anywhere
-path, OCTAVE = checkProg('Octave', ['octave'])
+ # run latex on chklatex.ltx and check result
+ if cmdOutput(LATEX + ' chklatex.ltx').find('ThisIsLaTeX2e') != -1:
+ # valid latex2e
+ return LATEX
+ else:
+ print "Latex not usable (not LaTeX2e) "
+ # remove temporary files
+ removeFiles(['chklatex.ltx', 'chklatex.log'])
+ return ''
+
+
+def checkFormatEntries(dtl_tools):
+ ''' Check all formats (\Format entries) '''
+ checkViewer('a Tgif viewer and editor', ['tgif'],
+ rc_entry = [r'\Format tgif obj Tgif "" "%%" "%%" "vector"'])
+ #
+ checkViewer('a FIG viewer and editor', ['xfig'],
+ rc_entry = [r'\Format fig fig FIG "" "%%" "%%" "vector"'])
+ #
+ checkViewer('a Grace viewer and editor', ['xmgrace'],
+ rc_entry = [r'\Format agr agr Grace "" "%%" "%%" "vector"'])
+ #
+ checkViewer('a FEN viewer and editor', ['xboard -lpf $$i -mode EditPosition'],
+ rc_entry = [r'\Format fen fen FEN "" "%%" "%%" ""'])
+ #
+ path, iv = checkViewer('a raster image viewer', ['xv', 'kview', 'gimp-remote', 'gimp'])
+ path, ie = checkViewer('a raster image editor', ['gimp-remote', 'gimp'])
+ addToRC(r'''\Format bmp bmp BMP "" "%s" "%s" ""
+\Format gif gif GIF "" "%s" "%s" ""
+\Format jpg jpg JPEG "" "%s" "%s" ""
+\Format pbm pbm PBM "" "%s" "%s" ""
+\Format pgm pgm PGM "" "%s" "%s" ""
+\Format png png PNG "" "%s" "%s" ""
+\Format ppm ppm PPM "" "%s" "%s" ""
+\Format tiff tif TIFF "" "%s" "%s" ""
+\Format xbm xbm XBM "" "%s" "%s" ""
+\Format xpm xpm XPM "" "%s" "%s" ""''' % \
+ (iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie) )
+ #
+ checkViewer('a text editor', ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate', \
+ 'nedit', 'gedit', 'notepad'],
+ rc_entry = [r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%" ""
+\Format asciiimage asc "Plain text (image)" "" "" "%%" ""
+\Format asciixfig asc "Plain text (Xfig output)" "" "" "%%" ""
+\Format dateout tmp "date (output)" "" "" "%%" ""
+\Format docbook sgml DocBook B "" "%%" "document"
+\Format docbook-xml xml "Docbook (XML)" "" "" "%%" "document"
+\Format literate nw NoWeb N "" "%%" "document"
+\Format lilypond ly "LilyPond music" "" "" "%%" "vector"
+\Format latex tex "LaTeX (plain)" L "" "%%" "document"
+\Format linuxdoc sgml LinuxDoc x "" "%%" "document"
+\Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document"
+\Format text txt "Plain text" a "" "%%" "document"
+\Format text2 txt "Plain text (pstotext)" "" "" "%%" "document"
+\Format text3 txt "Plain text (ps2ascii)" "" "" "%%" "document"
+\Format text4 txt "Plain text (catdvi)" "" "" "%%" "document"
+\Format textparagraph txt "Plain Text, Join Lines" "" "" "%%" "document"''' ])
+ #
+ #checkProg('a Postscript interpreter', ['gs'],
+ # rc_entry = [ r'\ps_command "%%"' ])
+ checkViewer('a Postscript previewer', ['gv', 'ghostview -swap', 'kghostview'],
+ rc_entry = [r'''\Format eps eps EPS "" "%%" "" "vector"
+\Format ps ps Postscript t "%%" "" "document,vector"'''])
+ #
+ checkViewer('a PDF previewer', ['acrobat', 'acroread', 'gv', 'ghostview', \
+ 'xpdf', 'kpdf', 'kghostview'],
+ rc_entry = [r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" "" "document,vector"
+\Format pdf2 pdf "PDF (pdflatex)" F "%%" "" "document,vector"
+\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document,vector"'''])
+ #
+ checkViewer('a DVI previewer', ['xdvi', 'kdvi'],
+ rc_entry = [r'\Format dvi dvi DVI D "%%" "" "document,vector"'])
+ if dtl_tools:
+ # Windows only: DraftDVI
+ addToRC(r'\Format dvi2 dvi DraftDVI "" "" "document,vector"')
+ #
+ checkViewer('an HTML previewer', ['firefox', 'mozilla file://$$p$$i', 'netscape'],
+ rc_entry = [r'\Format html html HTML H "%%" "" "document"'])
+ #
+ checkViewer('Noteedit', ['noteedit'],
+ rc_entry = [r'\Format noteedit not Noteedit "" "%%" "%%" "vector"'])
+ #
+ # entried that do not need checkProg
+ addToRC(r'''\Format date "" "date command" "" "" "" ""
+\Format fax "" Fax "" "" "" "document"
+\Format lyx lyx LyX "" "" "" ""
+\Format lyx13x lyx13 "LyX 1.3.x" "" "" "" "document"
+\Format lyx14x lyx14 "LyX 1.4.x" "" "" "" "document"
+\Format clyx cjklyx "CJK LyX 1.4.x (big5)" "" "" "" "document"
+\Format jlyx cjklyx "CJK LyX 1.4.x (euc-jp)" "" "" "" "document"
+\Format klyx cjklyx "CJK LyX 1.4.x (euc-kr)" "" "" "" "document"
+\Format lyxpreview lyxpreview "LyX Preview" "" "" "" ""
+\Format pdftex pdftex_t PDFTEX "" "" "" ""
+\Format program "" Program "" "" "" ""
+\Format pstex pstex_t PSTEX "" "" "" ""
+\Format rtf rtf "Rich Text Format" "" "" "" "document,vector"
+\Format sxw sxw "OpenOffice.Org Writer" O "" "" "document,vector"
+\Format wmf wmf "Windows Meta File" "" "" "" "vector"
+\Format word doc "MS Word" W "" "" "document,vector"
+\Format wordhtml html "HTML (MS Word)" "" "" "" "document"
+''')
+