X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fconfigure.py;h=7d9c3b91c812c6cf54136e0bb09d5c89affb31a3;hb=1a4b549a534c70cc8c336b0baeeb523d07c9cb58;hp=641e0fbe0fa648c56065ab0e56a634516e5928b3;hpb=425dfd3a247907eb3312ba5c2af6f4db372794b4;p=lyx.git diff --git a/lib/configure.py b/lib/configure.py index 641e0fbe0f..7d9c3b91c8 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -183,12 +183,21 @@ def checkViewer(description, progs, rc_entry = [], path = []): return checkProg(description, progs, rc_entry, path, not_found = 'auto') -def checkLatex(): - ''' Check latex, return lyx_check_config ''' +def checkDTLtools(): + ''' Check whether DTL tools are available (Windows only) ''' # Find programs! Returned path is not used now if ((os.name == 'nt' or sys.platform == 'cygwin') and checkProg('DVI to DTL converter', ['dv2dt']) != ['', ''] and checkProg('DTL to DVI converter', ['dt2dv']) != ['', '']): + dtl_tools = True + else: + dtl_tools = False + return dtl_tools + + +def checkLatex(dtl_tools): + ''' Check latex, return lyx_check_config ''' + if dtl_tools: # Windows only: DraftDVI converter_entry = r'''\converter latex dvi2 "%%" "latex" \converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' @@ -217,16 +226,16 @@ def checkLatex(): return '' -def checkFormatEntries(): +def checkFormatEntries(dtl_tools): ''' Check all formats (\Format entries) ''' checkViewer('a Tgif viewer and editor', ['tgif'], - rc_entry = [r'\Format tgif obj Tgif "" "%%" "%%" ""']) + rc_entry = [r'\Format tgif obj Tgif "" "%%" "%%" "vector"']) # checkViewer('a FIG viewer and editor', ['xfig'], - rc_entry = [r'\Format fig fig FIG "" "%%" "%%" ""']) + rc_entry = [r'\Format fig fig FIG "" "%%" "%%" "vector"']) # checkViewer('a Grace viewer and editor', ['xmgrace'], - rc_entry = [r'\Format agr agr Grace "" "%%" "%%" ""']) + 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 "" "%%" "%%" ""']) @@ -254,6 +263,7 @@ def checkFormatEntries(): \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" @@ -266,22 +276,20 @@ def checkFormatEntries(): #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 "" "%%" "" "" -\Format ps ps Postscript t "%%" "" "document"''']) + 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" -\Format pdf2 pdf "PDF (pdflatex)" F "%%" "" "document" -\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document"''']) + 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"']) - if ((os.name == 'nt' or sys.platform == 'cygwin') and - checkProg('DVI to DTL converter', ['dv2dt']) != ['', ''] and - checkProg('DTL to DVI converter', ['dt2dv']) != ['', '']): + rc_entry = [r'\Format dvi dvi DVI D "%%" "" "document,vector"']) + if dtl_tools: # Windows only: DraftDVI - addToRC(r'\Format dvi2 dvi DraftDVI "" "" "document"') + addToRC(r'\Format dvi2 dvi DraftDVI "" "" "document,vector"') # checkViewer('a HTML previewer', ['mozilla file://$$p$$i', 'netscape'], rc_entry = [r'\Format html html HTML H "%%" "" "document"']) @@ -295,8 +303,10 @@ def checkFormatEntries(): \Format pdftex pdftex_t PDFTEX "" "" "" "" \Format program "" Program "" "" "" "" \Format pstex pstex_t PSTEX "" "" "" "" -\Format sxw sxw "OpenOffice.Org Writer" O "" "" "document" -\Format word doc "MS Word" W "" "" "document" +\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 "MS Word (HTML)" "" "" "" "document" ''') @@ -339,6 +349,9 @@ def checkConverterEntries(): # checkProg('a LaTeX -> OpenOffice.org converter', ['oolatex $$i', 'oolatex.sh $$i'], rc_entry = [ r'\converter latex sxw "%%" "latex"' ]) + # On windows it is called latex2rt.exe + checkProg('a LaTeX -> RTF converter', ['latex2rtf -p -S -o $$o $$i', 'latex2rt -p -S -o $$o $$i'], + rc_entry = [ r'\converter latex rtf "%%" "needaux"' ]) # checkProg('a PS to PDF converter', ['ps2pdf13 $$i $$o'], rc_entry = [ r'\converter ps pdf "%%" ""' ]) @@ -385,6 +398,9 @@ def checkConverterEntries(): \converter tgif pdf "tgif -stdout -print -color -pdf $$i > $$o" ""''', '']) # + checkProg('a WMF -> EPS converter', ['wmf2eps -o $$o $$i'], + rc_entry = [ r'\converter wmf eps "%%" ""', '']) + # checkProg('a EPS -> PDF converter', ['epstopdf'], rc_entry = [ r'\converter eps pdf "epstopdf --outfile=$$o $$i" ""', '']) # @@ -400,6 +416,24 @@ def checkConverterEntries(): 'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'], rc_entry = [ r'\converter latex html "%%" "originaldir,needaux"' ]) # + path, lilypond = checkProg('a LilyPond -> EPS/PDF/PNG converter', ['lilypond']) + if (lilypond != ''): + version_string = cmdOutput("lilypond --version") + match = re.match('GNU LilyPond (\S+)', version_string) + if match: + version_number = match.groups()[0] + version = version_number.split('.') + if int(version[0]) > 2 or (len(version) > 1 and int(version[0]) == 2 and int(version[1]) >= 6): + addToRC(r'''\converter lilypond eps "lilypond -b eps --ps $$i" "" +\converter lilypond png "lilypond -b eps --png $$i" ""''') + if int(version[0]) > 2 or (len(version) > 1 and int(version[0]) == 2 and int(version[1]) >= 9): + addToRC(r'\converter lilypond pdf "lilypond -b eps --pdf $$i" ""') + print '+ found LilyPond version %s.' % version_number + else: + print '+ found LilyPond, but version %s is too old.' % version_number + else: + print '+ found LilyPond, but could not extract version number.' + # # FIXME: no rc_entry? comment it out # checkProg('Image converter', ['convert $$i $$o']) # @@ -496,7 +530,7 @@ def processLayoutFile(file, bool_docbook, bool_linuxdoc): ''' classname = file.split(os.sep)[-1].split('.')[0] # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclearLaTeXClass[a,b,c]{article} - p = re.compile(r'\Declare(LaTeX|DocBook|LinuxDoc)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}') + p = re.compile(r'\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}') for line in open(file).readlines(): res = p.search(line) if res != None: @@ -558,7 +592,7 @@ def checkLatexConfig(check_config, bool_docbook, bool_linuxdoc): # Construct the list of classes to test for. # build the list of available layout files and convert it to commands # for chkconfig.ltx - p1 = re.compile(r'\Declare(LaTeX|DocBook|LinuxDoc)Class') + p1 = re.compile(r'\Declare(LaTeX|DocBook)Class') testclasses = list() for file in glob.glob( os.path.join('layouts', '*.layout') ) + \ glob.glob( os.path.join(srcdir, 'layouts', '*.layout' ) ) : @@ -729,6 +763,7 @@ Options: setEnviron() createDirectories() windows_style_tex_paths = checkTeXPaths() + dtl_tools = checkDTLtools() ## Write the first part of outfile writeToFile(outfile, '''# This file has been automatically generated by LyX' lib/configure.py # script. It contains default settings that have been determined by @@ -738,8 +773,8 @@ Options: # override the values given here. ''') # check latex - LATEX = checkLatex() - checkFormatEntries() + LATEX = checkLatex(dtl_tools) + checkFormatEntries(dtl_tools) checkConverterEntries() (chk_linuxdoc, bool_linuxdoc, linuxdoc_cmd) = checkLinuxDoc() (chk_docbook, bool_docbook, docbook_cmd) = checkDocBook()