X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fconfigure.py;h=c6c2ddd6202742b97c5f6af9cac92b6168e719d6;hb=88099cf89aa6db90ed862f43348c9ed8c48b08a4;hp=f9ace18d39a1a9dd727541681b2cc4e4a1a9dd55;hpb=b3ace671d2b1e1c4b57facb3c5a48f1c154fbd1d;p=lyx.git diff --git a/lib/configure.py b/lib/configure.py index f9ace18d39..c6c2ddd620 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -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 @@ -295,6 +296,9 @@ def checkFormatEntries(dtl_tools): 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" @@ -310,7 +314,6 @@ def checkFormatEntries(dtl_tools): \Format pstex pstex_t PSTEX "" "" "" "" \Format rtf rtf "Rich Text Format" "" "" "" "document,vector" \Format sxw sxw "OpenOffice.Org (sxw)" "" "" "" "document,vector" -\Format odt odt "Open Document" O "" "" "document,vector" \Format wmf wmf "Windows Metafile" "" "" "" "vector" \Format emf emf "Enhanced Metafile" "" "" "" "vector" \Format word doc "MS Word" W "" "" "document,vector" @@ -347,19 +350,22 @@ def checkConverterEntries(): # checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'], rc_entry = [ r'\converter word latex "%%" ""' ]) - # - path, htmlconv = checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'tth -t -e2 -L$$b < $$i > $$o', \ + # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ + path, htmlconv = checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'htlatex.sh $$i', \ + '/usr/share/tex4ht/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': + if htmlconv.find('htlatex') >= 0 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'"], + # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ + path, htmlconv = checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'", \ + "htlatex.sh $$i 'html,word' 'symbol/!' '-cvalidate'", \ + "/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"], rc_entry = [ r'\converter latex wordhtml "%%" "needaux"' ]) - if htmlconv == 'htlatex': + if htmlconv.find('htlatex') >= 0: 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'], @@ -367,9 +373,12 @@ def checkConverterEntries(): # 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'], - rc_entry = [ r'\converter latex odt "%%" "latex"' ]) + # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ + # Both SuSE and debian have oolatex + checkProg('a LaTeX -> Open Document converter', ['oolatex $$i', 'oolatex.sh $$i', \ + '/usr/share/tex4ht/oolatex $$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"' ]) @@ -621,7 +630,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) ) @@ -728,6 +737,57 @@ s!@chk_docbook@!%s!g ''.join(lyxin)) +def checkModulesConfig(): + removeFiles(['lyxmodules.lst']) + + print '+checking list of modules... ' + tx = open('lyxmodules.lst', 'w') + tx.write('''## This file declares modules and their associated definition files. +## It has been automatically generated by configure +## Use "Options/Reconfigure" if you need to update it after a +## configuration change. +''') + # build the list of available modules + foundClasses = [] + for file in glob.glob( os.path.join('layouts', '*.module') ) + \ + glob.glob( os.path.join(srcdir, 'layouts', '*.module' ) ) : + # valid file? + print file + if not os.path.isfile(file): + continue + tx.write(processModuleFile(file, bool_docbook, bool_linuxdoc)) + tx.close() + print '\tdone' + +def processModuleFile(file, bool_docbook, bool_linuxdoc): + ''' process module file and get a line of result + + Declare lines look like this: + \DeclareLyXModule[LaTeX Packages]{Description}{ModuleName}... + We expect output: + "ModuleName" "filename" "Description" "Packages" + " + ''' + p = re.compile(r'\DeclareLyXModule\s*(?:\[([^]]*)\])?{(.*)}{(.*)}') + for line in open(file).readlines(): + res = p.search(line) + if res != None: + (packages, desc, modname) = res.groups() + #check availability...need to add that + if packages == None: + packages = "" + else: + pkgs = [s.strip() for s in packages.split(",")] + packages = ",".join(pkgs) + + filename = file.split(os.sep)[-1] + return '"%s" "%s" "%s" "%s"\n' % (modname, filename, desc, packages) + print "Module file without \DeclareLyXModule line. " + sys.exit(2) + + + + def checkTeXAllowSpaces(): ''' Let's check whether spaces are allowed in TeX file names ''' tex_allows_spaces = 'false' @@ -821,4 +881,5 @@ Options: # --without-latex-config can disable lyx_check_config checkLatexConfig( lyx_check_config and LATEX != '', bool_docbook, bool_linuxdoc) createLaTeXConfig() + checkModulesConfig() #lyx_check_config and LATEX != '') removeTempFiles()