]> git.lyx.org Git - lyx.git/blobdiff - lib/configure.py
revert mistake.
[lyx.git] / lib / configure.py
index f841da37983bb85c1da511bec64a96e1033e0e44..4fa87da2ed1dd67642631b4577026b428ff7d930 100644 (file)
@@ -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,7 +226,7 @@ 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                   "" "%%"        "%%"    "vector"'])
@@ -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"
@@ -277,20 +287,22 @@ def checkFormatEntries():
     #
     checkViewer('a DVI previewer', ['xdvi', 'kdvi'],
         rc_entry = [r'\Format dvi        dvi     DVI                    D  "%%"        ""      "document,vector"'])
-    if ((os.name == 'nt' or sys.platform == 'cygwin') and
-            checkProg('DVI to DTL converter', ['dv2dt']) != ['', ''] and
-            checkProg('DTL to DVI converter', ['dt2dv']) != ['', '']):
+    if dtl_tools:
         # Windows only: DraftDVI
         addToRC(r'\Format dvi2       dvi     DraftDVI               "" ""      "document,vector"')
     #
-    checkViewer('a HTML previewer', ['mozilla file://$$p$$i', 'netscape'],
+    checkViewer('an HTML previewer', ['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 lyxpreview lyxpreview "LyX Preview"       "" ""        ""      ""
 \Format pdftex     pdftex_t PDFTEX                "" ""        ""      ""
 \Format program    ""      Program                "" ""        ""      ""
@@ -299,7 +311,7 @@ def checkFormatEntries():
 \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"
+\Format wordhtml   html   "HTML (MS Word)"        "" ""        ""      "document"
 ''')
 
 
@@ -327,10 +339,10 @@ def checkConverterEntries():
     checkProg('a Noweb -> LaTeX converter', ['noweave -delay -index $$i > $$o'],
         rc_entry = [ r'\converter literate   latex      "%%"   ""' ])
     #
-    checkProg('a HTML -> LaTeX converter', ['html2latex $$i'],
+    checkProg('an HTML -> LaTeX converter', ['html2latex $$i'],
         rc_entry = [ r'\converter html       latex      "%%"   ""' ])
     #
-    checkProg('a MSWord -> LaTeX converter', ['wvCleanLatex $$i $$o'],
+    checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
         rc_entry = [ r'\converter word       latex      "%%"   ""' ])
     #
     checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
@@ -393,7 +405,7 @@ def checkConverterEntries():
     checkProg('a WMF -> EPS converter', ['wmf2eps -o $$o $$i'],
         rc_entry = [ r'\converter wmf        eps        "%%"   ""', ''])
     #
-    checkProg('a EPS -> PDF converter', ['epstopdf'],
+    checkProg('an EPS -> PDF converter', ['epstopdf'],
         rc_entry = [ r'\converter eps        pdf        "epstopdf --outfile=$$o $$i"   ""', ''])
     #
     checkProg('a Grace -> Image converter', ['gracebat'],
@@ -408,6 +420,27 @@ 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.'
+    #
+    checkProg('a Noteedit -> LilyPond converter', ['noteedit --export-lilypond $$i'],
+        rc_entry = [ r'\converter noteedit   lilypond   "%%"   ""', ''])
+    #
     # FIXME: no rc_entry? comment it out
     # checkProg('Image converter', ['convert $$i $$o'])
     #
@@ -419,6 +452,7 @@ def checkConverterEntries():
 \converter fig        pdftex     "python -tt $$s/scripts/fig2pdftex.py $$i $$o"        ""
 \converter fig        pstex      "python -tt $$s/scripts/fig2pstex.py $$i $$o" ""
 \converter lyx        lyx13x     "python -tt $$s/lyx2lyx/lyx2lyx -t 221 $$i > $$o"     ""
+\converter lyx        lyx14x     "python -tt $$s/lyx2lyx/lyx2lyx -t 245 $$i > $$o"     ""
 ''')
 
 
@@ -490,7 +524,7 @@ def checkOtherEntries():
 def processLayoutFile(file, bool_docbook, bool_linuxdoc):
     ''' process layout file and get a line of result
         
-        Declear line are like this: (article.layout, scrbook.layout, svjog.layout)
+        Declare lines look like this: (article.layout, scrbook.layout, svjog.layout)
         
         \DeclareLaTeXClass{article}
         \DeclareLaTeXClass[scrbook]{book (koma-script)}
@@ -503,7 +537,7 @@ def processLayoutFile(file, bool_docbook, bool_linuxdoc):
         "svjog" "svjour" "article (Springer - svjour/jog)" "false"
     '''
     classname = file.split(os.sep)[-1].split('.')[0]
-    # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclearLaTeXClass[a,b,c]{article}
+    # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
     p = re.compile(r'\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}')
     for line in open(file).readlines():
         res = p.search(line)
@@ -513,7 +547,7 @@ def processLayoutFile(file, bool_docbook, bool_linuxdoc):
             if opt == None:
                 opt = classname
             return '"%s" "%s" "%s" "%s"\n' % (classname, opt, desc, avai)
-    print "Layout file without \DeclearXXClass line. "
+    print "Layout file without \DeclareXXClass line. "
     sys.exit(2)
 
     
@@ -737,6 +771,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
@@ -746,8 +781,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()