Check only once for dtl tools in configure.py

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15892 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2006-11-12 21:59:19 +00:00
parent 5b8d08adef
commit 9d46ada90a

View File

@ -179,12 +179,21 @@ def checkViewer(description, progs, rc_entry = [], path = []):
return checkProg(description, progs, rc_entry, path, not_found = 'auto') return checkProg(description, progs, rc_entry, path, not_found = 'auto')
def checkLatex(): def checkDTLtools():
''' Check latex, return lyx_check_config ''' ''' Check whether DTL tools are available (Windows only) '''
# Find programs! Returned path is not used now # Find programs! Returned path is not used now
if ((os.name == 'nt' or sys.platform == 'cygwin') and if ((os.name == 'nt' or sys.platform == 'cygwin') and
checkProg('DVI to DTL converter', ['dv2dt']) != ['', ''] and checkProg('DVI to DTL converter', ['dv2dt']) != ['', ''] and
checkProg('DTL to DVI converter', ['dt2dv']) != ['', '']): 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 # Windows only: DraftDVI
converter_entry = r'''\converter latex dvi2 "%%" "latex" converter_entry = r'''\converter latex dvi2 "%%" "latex"
\converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' \converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""'''
@ -213,7 +222,7 @@ def checkLatex():
return '' return ''
def checkFormatEntries(): def checkFormatEntries(dtl_tools):
''' Check all formats (\Format entries) ''' ''' Check all formats (\Format entries) '''
checkViewer('a Tgif viewer and editor', ['tgif'], checkViewer('a Tgif viewer and editor', ['tgif'],
rc_entry = [r'\Format tgif obj Tgif "" "%%" "%%"']) rc_entry = [r'\Format tgif obj Tgif "" "%%" "%%"'])
@ -271,9 +280,7 @@ def checkFormatEntries():
# #
checkViewer('a DVI previewer', ['xdvi', 'kdvi'], checkViewer('a DVI previewer', ['xdvi', 'kdvi'],
rc_entry = [r'\Format dvi dvi DVI D "%%" ""']) rc_entry = [r'\Format dvi dvi DVI D "%%" ""'])
if ((os.name == 'nt' or sys.platform == 'cygwin') and if (dtl_tools):
checkProg('DVI to DTL converter', ['dv2dt']) != ['', ''] and
checkProg('DTL to DVI converter', ['dt2dv']) != ['', '']):
# Windows only: DraftDVI # Windows only: DraftDVI
addToRC(r'\Format dvi2 dvi DraftDVI "" "" ""') addToRC(r'\Format dvi2 dvi DraftDVI "" "" ""')
# #
@ -747,6 +754,7 @@ Options:
setEnviron() setEnviron()
createDirectories() createDirectories()
windows_style_tex_paths = checkTeXPaths() windows_style_tex_paths = checkTeXPaths()
dtl_tools = checkDTLtools()
## Write the first part of outfile ## Write the first part of outfile
writeToFile(outfile, '''# This file has been automatically generated by LyX' lib/configure.py writeToFile(outfile, '''# This file has been automatically generated by LyX' lib/configure.py
# script. It contains default settings that have been determined by # script. It contains default settings that have been determined by
@ -756,8 +764,8 @@ Options:
# override the values given here. # override the values given here.
''') ''')
# check latex # check latex
LATEX = checkLatex() LATEX = checkLatex(dtl_tools)
checkFormatEntries() checkFormatEntries(dtl_tools)
checkConverterEntries() checkConverterEntries()
(chk_linuxdoc, bool_linuxdoc, linuxdoc_cmd) = checkLinuxDoc() (chk_linuxdoc, bool_linuxdoc, linuxdoc_cmd) = checkLinuxDoc()
(chk_docbook, bool_docbook, docbook_cmd) = checkDocBook() (chk_docbook, bool_docbook, docbook_cmd) = checkDocBook()