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')
\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 text3 txt "Plain text (ps2ascii)" "" "" "%%" "document"
\Format text4 txt "Plain text (catdvi)" "" "" "%%" "document"
\Format textparagraph txt "Plain Text, Join Lines" "" "" "%%" "document"''' ])
+ #
+ path, xhtmlview = checkViewer('an HTML previewer', ['firefox', 'mozilla file://$$p$$i', 'netscape'],
+ rc_entry = [r'\Format xhtml html "LyX HTML" "" "%%" "" "document"'])
+ if xhtmlview == "":
+ addToRC(r'\Format xhtml html "LyX HTML" "" "" "%%" "document"')
#
checkViewer('a BibTeX editor', ['sensible-editor', 'jabref', 'JabRef', \
'pybliographic', 'bibdesk', 'gbib', 'kbib', \
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"'''])
- #
+ # for xdg-open issues look here: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg151818.html
checkViewer('a PDF previewer', ['kpdf', 'okular', 'evince', 'kghostview', 'xpdf', 'acrobat', 'acroread', \
'gv', 'ghostview'],
rc_entry = [r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" "" "document,vector"
rc_entry = [r'''\converter literate latex "%%" ""
\converter literate 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('a Sweave -> LaTeX converter', ['R CMD Sweave $$i'],
+ rc_entry = [r'''\converter sweave latex "%%" ""
+\converter sweave pdflatex "%%" ""'''])
#
checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \
'htmltolatex -input $$i -output $$o', 'java -jar htmltolatex.jar -input $$i -output $$o'],
#
checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
rc_entry = [ r'\converter word latex "%%" ""' ])
- # 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.find('htlatex') >= 0 or htmlconv == 'latex2html':
- addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
+ #
+ path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py --directory $$r $$i $$o','elyxer --directory $$r $$i $$o'],
+ rc_entry = [ r'\converter lyx html "%%" ""' ])
+ if elyxer.find('elyxer') >= 0:
+ addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
else:
- addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py $$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.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"''')
# 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'"],
+ "/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
rc_entry = [ r'\converter latex wordhtml "%%" "needaux"' ])
if htmlconv.find('htlatex') >= 0:
addToRC(r'''\copier wordhtml "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
else:
addToRC(r'\converter lyxpreview png "" ""')
#
- checkProg('a fax program', ['kdeprintfax $$i', 'ksendfax $$i'],
+ checkProg('a fax program', ['kdeprintfax $$i', 'ksendfax $$i', 'hylapex $$i'],
rc_entry = [ r'\converter ps fax "%%" ""'])
#
checkProg('a FIG -> EPS/PPM converter', ['fig2dev'],
''' entries other than Format and Converter '''
checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],
rc_entry = [ r'\chktex_command "%%"' ])
- checkProg('BibTeX', ['bibtex'],
- rc_entry = [ r'\bibtex_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 "%%"' ])
- checkProg('an index processor', ['texindy', 'makeindex -c -q'],
- rc_entry = [ r'\index_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'],
The top of a module file should look like this:
#\DeclareLyXModule[LaTeX Packages]{ModuleName}
- #BeginDescription
+ #DescriptionBegin
#...body of description...
- #EndDescription
+ #DescriptionEnd
#Requires: [list of required modules]
#Excludes: [list of excluded modules]
The last two lines are optional