]> git.lyx.org Git - lyx.git/blobdiff - lib/configure.py
DummyDocument1/2.lyx: fix author names, a relict of a bug in LyX 1.5.0beta times
[lyx.git] / lib / configure.py
index 53c0c47d7a3b9498f398b657c10fbaf5890ae20c..9cb6e4f65baf3bebb54a77a8c4f94f923b7b14a1 100644 (file)
@@ -104,6 +104,7 @@ def checkTeXPaths():
             inpname = tmpfname.replace('\\', '/')
         else:
             inpname = cmdOutput('cygpath -m ' + tmpfname)
+        logname = os.path.basename(inpname.replace('.ltx', '.log'))
         inpname = inpname.replace('~', '\\string~')
         os.write(fd, r'\relax')
         os.close(fd)
@@ -114,7 +115,7 @@ def checkTeXPaths():
         else:
             print "configure: TeX engine needs windows-style paths in latex files"
             windows_style_tex_paths = 'true'
-        removeFiles([tmpfname, 'texput.log'])
+        removeFiles([tmpfname, logname, 'texput.log'])
     return windows_style_tex_paths
 
 
@@ -238,8 +239,8 @@ def checkFormatEntries(dtl_tools):
     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'])
-    path, ie = checkViewer('a raster image editor', ['gimp'])
+    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"    ""
@@ -273,12 +274,12 @@ def checkFormatEntries(dtl_tools):
     #
     #checkProg('a Postscript interpreter', ['gs'],
     #  rc_entry = [ r'\ps_command "%%"' ])
-    checkViewer('a Postscript previewer', ['gv', 'ghostview -swap', 'kghostview'],
+    checkViewer('a Postscript previewer', ['kghostview', 'evince', 'gv', 'ghostview -swap'],
         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'],
+    checkViewer('a PDF previewer', ['kpdf', 'evince', 'kghostview', 'xpdf', 'acrobat', 'acroread', \
+                   'gv', 'ghostview'],
         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"'''])
@@ -289,12 +290,15 @@ def checkFormatEntries(dtl_tools):
         # Windows only: DraftDVI
         addToRC(r'\Format dvi2       dvi     DraftDVI               "" ""      "document,vector"')
     #
-    checkViewer('an HTML previewer', ['mozilla file://$$p$$i', 'netscape'],
+    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"'])
     #
+    checkViewer('an OpenDocument viewer', ['oowriter'],
+        rc_entry = [r'\Format odt        odt     OpenDocument           "" "%%"        "%%"    "document,vector"'])
+    #
     # entried that do not need checkProg
     addToRC(r'''\Format date       ""     "date command"          "" ""        ""      ""
 \Format fax        ""      Fax                    "" ""        ""      "document"
@@ -309,8 +313,9 @@ def checkFormatEntries(dtl_tools):
 \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 sxw        sxw    "OpenOffice.Org (sxw)"  ""  ""       ""      "document,vector"
+\Format wmf        wmf    "Windows Metafile"      "" ""        ""      "vector"
+\Format emf        emf    "Enhanced Metafile"     "" ""        ""      "vector"
 \Format word       doc    "MS Word"               W  ""        ""      "document,vector"
 \Format wordhtml   html   "HTML (MS Word)"        "" ""        ""      "document"
 ''')
@@ -346,14 +351,28 @@ def checkConverterEntries():
     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'"],
-        rc_entry = [ r'\converter latex      wordhtml   "%%"   ""' ])
+    path, htmlconv = checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'tth  -t -e2 -L$$b < $$i > $$o', \
+        'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'],
+        rc_entry = [ r'\converter latex      html       "%%"   "needaux"' ])
+    if htmlconv == 'htlatex' or htmlconv == 'latex2html':
+      addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
+    else:
+      addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py $$i $$o"''')
+
+    #
+    path, htmlconv = checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
+        rc_entry = [ r'\converter latex      wordhtml   "%%"   "needaux"' ])
+    if htmlconv == 'htlatex':
+      addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
     #
     checkProg('an OpenOffice.org -> LaTeX converter', ['w2l -clean $$i'],
         rc_entry = [ r'\converter sxw        latex      "%%"   ""' ])
     #
-    checkProg('a LaTeX -> OpenOffice.org converter', ['oolatex $$i', 'oolatex.sh $$i'],
-        rc_entry = [ r'\converter latex      sxw        "%%"   "latex"' ])
+    checkProg('an OpenDocument -> LaTeX converter', ['w2l -clean $$i'],
+        rc_entry = [ r'\converter odt        latex      "%%"   ""' ])
+    #
+    checkProg('a LaTeX -> Open Document converter', ['oolatex $$i', 'oolatex.sh $$i', 'htlatex $$i \'xhtml,ooffice\' \'ooffice/! -cmozhtf\' \'-coo\' \'-cvalidate\''],
+        rc_entry = [ r'\converter latex      odt        "%%"   "needaux"' ])
     # 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"' ])
@@ -403,19 +422,19 @@ 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 WMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i'],
+        rc_entry = [ r'\converter wmf        eps        "%%"   ""'])
+    #
+    checkProg('an EMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i'],
+        rc_entry = [ r'\converter emf        eps        "%%"   ""'])
     #
     checkProg('an EPS -> PDF converter', ['epstopdf'],
         rc_entry = [ r'\converter eps        pdf        "epstopdf --outfile=$$o $$i"   ""', ''])
     #
-    path, convert = checkProg('a PDF -> PNG converter', ['convert'])
-    if convert != '':
-        # check whether convert supports the -define option
-        conv_opts = "-define pdf:use-cropbox=true -depth 8"
-        if not 'Unrecognized' in cmdOutput('convert ' + conv_opts + ' 2>&1'):
-            addToRC(r'\converter pdf        png        "convert %s pdf:$$i png:$$o"    ""' % conv_opts)
-    #
+    # no agr -> pdf converter, since the pdf library used by gracebat is not
+    # free software and therefore not compiled in in many installations.
+    # Fortunately, this is not a big problem, because we will use epstopdf to
+    # convert from agr to pdf via eps without loss of quality.
     checkProg('a Grace -> Image converter', ['gracebat'],
         rc_entry = [
             r'''\converter agr        eps        "gracebat -hardcopy -printfile $$o -hdevice EPS $$i 2>/dev/null"      ""
@@ -424,9 +443,6 @@ def checkConverterEntries():
 \converter agr        ppm        "gracebat -hardcopy -printfile $$o -hdevice PNM $$i 2>/dev/null"      ""''',
             ''])
     #
-    checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'tth  -t -e2 -L$$b < $$i > $$o', \
-        '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 != ''):
@@ -532,6 +548,7 @@ def checkOtherEntries():
     addToRC(r'''\copier    fig        "python -tt $$s/scripts/fig_copy.py $$i $$o"
 \copier    pstex      "python -tt $$s/scripts/tex_copy.py $$i $$o $$l"
 \copier    pdftex     "python -tt $$s/scripts/tex_copy.py $$i $$o $$l"
+\copier    program    "python -tt $$s/scripts/ext_copy.py $$i $$o"
 ''')
 
 
@@ -607,7 +624,7 @@ def checkLatexConfig(check_config, bool_docbook, bool_linuxdoc):
             'chkconfig.classes', 'chklayouts.tex'])
         rmcopy = False
         if not os.path.isfile( 'chkconfig.ltx' ):
-            shutil.copy( os.path.join(srcdir, 'chkconfig.ltx'),  'chkconfig.ltx' )
+            shutil.copyfile( os.path.join(srcdir, 'chkconfig.ltx'), 'chkconfig.ltx' )
             rmcopy = True
         writeToFile('wrap_chkconfig.ltx', '%s\n%s\n\\input{chkconfig.ltx}\n' \
             % (linuxdoc_cmd, docbook_cmd) )