Attached is a patch to fix issues #6339 and #7579 in configure. The bug
is that we check whether perl or java are installed, but we do not check
that the actual scripts are also installed.
In the patch, I look once for the java interpreter and once for the perl
interpreter. This information is passed onto the subsequent checks for
converters. At the moment, we search once for a perl script and twice
for a java script. Both the interpreter and the script needs to be
present before we add a line to lyxrc.defaults
One question I have is this:
addToRC(r'\splitindex_command "%s -w %s"'
% (perl, os.path.join(path, splitindex)))
I feel that I need to add "" around the second %s to protect against
spaces in the path to splitindex, but how to add them? maybe like this:
addToRC(r'\splitindex_command "%s -w \"%s\""'
% (perl, os.path.join(path, splitindex)))
is that right?
--
Julien
diff --git a/lib/configure.py b/lib/configure.py
index 16c7e4c..a70b887 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -609,7 +609,7 @@ def checkFormatEntries(dtl_tools):
''')
-def checkConverterEntries():
+def checkConverterEntries(java='', perl=''):
''' Check all converters (\converter entries) '''
checkProg('the pdflatex program', ['pdflatex $$i'],
rc_entry = [ r'\converter pdflatex pdf2 "%%" "latex=pdflatex"' ])
@@ -649,9 +649,14 @@ def checkConverterEntries():
checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'],
rc_entry = [ r'\converter sweave r "%%" ""' ])
#
- checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \
- 'htmltolatex -input $$i -output $$o', 'java -jar htmltolatex.jar -input $$i -output $$o'],
- rc_entry = [ r'\converter html latex "%%" ""' ])
+ path, htmltolatex = checkProg('an HTML -> LaTeX converter', ['html2latex $$i',
+ 'gnuhtml2latex $$i', 'htmltolatex -input $$i -output $$o', 'htmltolatex.jar'],
+ rc_entry = [ r'\converter html latex "%%" ""',
+ r'\converter html latex "%%" ""',
+ r'\converter html latex "%%" ""', '', ''] )
+ if htmltolatex == 'htmltolatex.jar' and java != '':
+ addToRC(r'\converter html latex "%s -jar %s -input $$i -output $$o" ""'
+ % (java, os.path.join(path, htmltolatex)))
#
checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
rc_entry = [ r'\converter word latex "%%" ""' ])
@@ -942,7 +947,7 @@ def checkDocBook():
return ('no', 'false', '')
-def checkOtherEntries():
+def checkOtherEntries(java='', perl=''):
''' entries other than Format and Converter '''
checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],
rc_entry = [ r'\chktex_command "%%"' ])
@@ -956,11 +961,12 @@ def checkOtherEntries():
alt_rc_entry = [ r'\index_alternatives "%%"' ])
checkProg('an index processor appropriate to Japanese', ['mendex -c -q', 'jmakeindex -c -q', 'makeindex -c -q'],
rc_entry = [ r'\jindex_command "%%"' ])
- path, splitindex = checkProg('the splitindex processor', ['splitindex.pl', 'splitindex'],
- rc_entry = [ r'\splitindex_command "%%"' ])
- if splitindex == '':
- checkProg('the splitindex processor (java version)', ['splitindex.class'],
- rc_entry = [ r'\splitindex_command "java splitindex"' ])
+ path, splitindex = checkProg('the splitindex processor', ['splitindex.pl', 'splitindex',
+ 'splitindex.class'], rc_entry = ['', r'\splitindex_command "%%"', '', ''])
+ if splitindex == 'splitindex.pl' and perl != '':
+ addToRC(r'\splitindex_command "%s -w %s"' % (perl, os.path.join(path, splitindex)))
+ elif splitindex == 'splitindex.class' and java != '':
+ addToRC(r'\splitindex_command "%s %s"' % (java, os.path.join(path, 'splitindex')))
checkProg('a nomenclature processor', ['makeindex'],
rc_entry = [ r'\nomencl_command "makeindex -s nomencl.ist"' ])
## FIXME: OCTAVE is not used anywhere
@@ -1362,13 +1368,15 @@ Format %i
# check latex
LATEX = checkLatex(dtl_tools)
checkFormatEntries(dtl_tools)
- checkConverterEntries()
+ java = checkProg('a java interpreter', ['java'])[1]
+ perl = checkProg('a perl interpreter', ['perl'])[1]
+ checkConverterEntries(java, perl)
(chk_docbook, bool_docbook, docbook_cmd) = checkDocBook()
checkTeXAllowSpaces()
windows_style_tex_paths = checkTeXPaths()
if windows_style_tex_paths != '':
addToRC(r'\tex_expects_windows_paths %s' % windows_style_tex_paths)
- checkOtherEntries()
+ checkOtherEntries(java, perl)
checkModulesConfig()
# --without-latex-config can disable lyx_check_config
ret = checkLatexConfig(lyx_check_config and LATEX != '', bool_docbook)