X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fconfigure.py;h=853af753377762dee701bd1853fc5346e16cc3f4;hb=2537cd07f496d05574e5b997a5d415484c8710f6;hp=c4b5eacb76f62417808458a9f86805e8a31877f4;hpb=b52205d30bda0be5e70770eecb160c4215e567ab;p=lyx.git diff --git a/lib/configure.py b/lib/configure.py index c4b5eacb76..853af75337 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -178,6 +178,67 @@ def checkProg(description, progs, rc_entry = [], path = [], not_found = ''): return ['', not_found] +## Searching some useful programs +def checkProgAlternatives(description, progs, rc_entry = [], alt_rc_entry = [], path = [], not_found = ''): + ''' + The same as checkProg, but additionally, all found programs will be added + as alt_rc_entries + ''' + # one rc entry for each progs plus not_found entry + if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1: + logger.error("rc entry should have one item or item for each prog and not_found.") + sys.exit(2) + # check if alt rcs are given + if len(alt_rc_entry) > 1 and len(alt_rc_entry) != len(rc_entry): + logger.error("invalid alt_rc_entry specification.") + sys.exit(2) + logger.info('checking for ' + description + '...') + ## print '(' + ','.join(progs) + ')', + found_prime = False + real_ac_dir = '' + real_ac_word = not_found + for idx in range(len(progs)): + # ac_prog may have options, ac_word is the command name + ac_prog = progs[idx] + ac_word = ac_prog.split(' ')[0] + msg = '+checking for "' + ac_word + '"... ' + path = os.environ["PATH"].split(os.pathsep) + path + extlist = [''] + if os.environ.has_key("PATHEXT"): + extlist = extlist + os.environ["PATHEXT"].split(os.pathsep) + found_alt = False + for ac_dir in path: + for ext in extlist: + if os.path.isfile( os.path.join(ac_dir, ac_word + ext) ): + logger.info(msg + ' yes') + # write rc entries for this command + if found_prime == False: + if len(rc_entry) == 1: + addToRC(rc_entry[0].replace('%%', ac_prog)) + elif len(rc_entry) > 1: + addToRC(rc_entry[idx].replace('%%', ac_prog)) + real_ac_dir = ac_dir + real_ac_word = ac_word + found_prime = True + if len(alt_rc_entry) == 1: + addToRC(alt_rc_entry[0].replace('%%', ac_prog)) + elif len(alt_rc_entry) > 1: + addToRC(alt_rc_entry[idx].replace('%%', ac_prog)) + found_alt = True + break + if found_alt: + break + if found_alt == False: + # if not successful + logger.info(msg + ' no') + if found_prime: + return [real_ac_dir, real_ac_word] + # write rc entries for 'not found' + if len(rc_entry) > 0: # the last one. + addToRC(rc_entry[-1].replace('%%', not_found)) + return ['', not_found] + + def checkViewer(description, progs, rc_entry = [], path = []): ''' The same as checkProg, but for viewers and editors ''' return checkProg(description, progs, rc_entry, path, not_found = 'auto') @@ -288,9 +349,11 @@ def checkFormatEntries(dtl_tools): \Format dot dot "Graphviz Dot" "" "" "%%" "vector" \Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document" \Format literate nw NoWeb N "" "%%" "document" +\Format sweave Rnw "Sweave" S "" "%%" "document" \Format lilypond ly "LilyPond music" "" "" "%%" "vector" \Format latex tex "LaTeX (plain)" L "" "%%" "document" \Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document" +\Format xetex tex "LaTeX (XeTeX)" "" "" "%%" "document" \Format text txt "Plain text" a "" "%%" "document" \Format text2 txt "Plain text (pstotext)" "" "" "%%" "document" \Format text3 txt "Plain text (ps2ascii)" "" "" "%%" "document" @@ -306,17 +369,18 @@ def checkFormatEntries(dtl_tools): # #checkProg('a Postscript interpreter', ['gs'], # rc_entry = [ r'\ps_command "%%"' ]) - checkViewer('a Postscript previewer', ['kghostview', 'evince', 'gv', 'ghostview -swap'], + checkViewer('a Postscript previewer', ['kghostview', 'okular', 'evince', 'gv', 'ghostview -swap'], rc_entry = [r'''\Format eps eps EPS "" "%%" "" "vector" \Format ps ps Postscript t "%%" "" "document,vector"''']) # - checkViewer('a PDF previewer', ['kpdf', 'evince', 'kghostview', 'xpdf', 'acrobat', 'acroread', \ + checkViewer('a PDF previewer', ['kpdf', 'okular', '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"''']) +\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document,vector" +\Format pdf4 pdf "PDF (XeTeX)" X "%%" "" "document,vector"''']) # - checkViewer('a DVI previewer', ['xdvi', 'kdvi'], + checkViewer('a DVI previewer', ['xdvi', 'kdvi', 'okular'], rc_entry = [r'\Format dvi dvi DVI D "%%" "" "document,vector"']) if dtl_tools: # Windows only: DraftDVI @@ -353,7 +417,7 @@ def checkFormatEntries(dtl_tools): \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" +\Format wordhtml html "HTML (MS Word)" "" "" "" "document" ''') @@ -361,6 +425,9 @@ def checkConverterEntries(): ''' Check all converters (\converter entries) ''' checkProg('the pdflatex program', ['pdflatex $$i'], rc_entry = [ r'\converter pdflatex pdf2 "%%" "latex"' ]) + + checkProg('XeTeX', ['xelatex $$i'], + rc_entry = [ r'\converter xetex pdf4 "%%" "latex"' ]) ''' If we're running LyX in-place then tex2lyx will be found in ../src/tex2lyx. Add this directory to the PATH temporarily and @@ -381,6 +448,18 @@ def checkConverterEntries(): checkProg('a Noweb -> LaTeX converter', ['noweave -delay -index $$i > $$o'], rc_entry = [r'''\converter literate latex "%%" "" \converter literate pdflatex "%%" ""''']) + # + checkProg('a Sweave -> LaTeX converter', ['R CMD Sweave $$i'], + rc_entry = [r'''\converter sweave latex "%%" "" +\converter sweave pdflatex "%%" ""''']) + # + path, elyx = checkProg('eLyXer converter', ['elyxer.py $$i $$o'], + rc_entry = [ r'\converter lyx html2 "%%" ""' ] ) + if elyx.find('elyxer.py') >= 0 : + addToRC(r'''\copier html2 "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''') + checkViewer('an eLyXer previewer', ['firefox', 'mozilla file://$$p$$i', 'netscape'], + rc_entry = [r'\Format html2 html "HTML (eLyXer)" e "%%" "" "document"']) + # checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \ 'htmltolatex -input $$i -output $$o', 'java -jar htmltolatex.jar -input $$i -output $$o'], @@ -586,10 +665,18 @@ def checkOtherEntries(): ''' entries other than Format and Converter ''' checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'], rc_entry = [ r'\chktex_command "%%"' ]) - checkProg('BibTeX', ['jbibtex', 'bibtex'], - rc_entry = [ r'\bibtex_command "%%"' ]) - checkProg('an index processor', ['texindy', 'makeindex -c -q'], - rc_entry = [ r'\index_command "%%"' ]) + checkProgAlternatives('BibTeX or alternative programs', ['bibtex', 'bibtex8', 'biber'], + rc_entry = [ r'\bibtex_command "%%"' ], + alt_rc_entry = [ r'\bibtex_alternatives "%%"' ]) + checkProg('JBibTeX, the Japanese BibTeX', ['jbibtex', 'bibtex'], + rc_entry = [ r'\jbibtex_command "%%"' ]) + checkProgAlternatives('available index processors', ['texindy', 'makeindex -c -q'], + rc_entry = [ r'\index_command "%%"' ], + alt_rc_entry = [ r'\index_alternatives "%%"' ]) + checkProg('an index processor appropriate to Japanese', ['mendex -c -q', 'makeindex -c -q'], + rc_entry = [ r'\jindex_command "%%"' ]) + checkProg('the splitindex processor', ['splitindex.pl', 'java splitindex', 'splitindex'], + rc_entry = [ r'\splitindex_command "%%"' ]) checkProg('a nomenclature processor', ['makeindex'], rc_entry = [ r'\nomencl_command "makeindex -s nomencl.ist"' ]) ## FIXME: OCTAVE is not used anywhere