There have been objections in the past towards letting reconfigure issue the 
TeXFiles.py script to update our information about cls, sty, bib and bst files 
for (performance reasons IIRC).

OTOH it is confusing that users have to press "Rescan" buttons to get up-to-
date data e.g. in the BibTeX dialog. Furthermore, chkltx.cfg is limited for it 
does not test for files in some TEXMF subdirectories, e.g. fonts/ (since 
\IfFileExists does not consider these directories). For future font support 
enhacements (e.g. support for OTF fonts in the TEXMF tree), it would be 
important to have this information as up to date as the packages.lst.

So I went ahead and checked how expensive this really is. With a complete 
TeXLive 2012 installation rather dated machine, I get this:

real    0m1.671s
user    0m1.282s
sys     0m0.291s

Subjectively, the reconfiguration is really not significantly longer than 
before.

Thus, I propose the attached patch (for trunk only).

Objections?

Jürgen
diff --git a/lib/configure.py b/lib/configure.py
index 168b379..81bc7d5 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1322,6 +1322,17 @@ def checkTeXAllowSpaces():
         removeFiles( [ 'a b.tex', 'a b.log', 'texput.log' ])
 
 
+def rescanTeXFiles():
+    ''' Run kpsewhich to update information about TeX files '''
+    logger.info("+Indexing TeX files... ")
+    if not os.path.isfile( os.path.join(srcdir, 'scripts', 'TeXFiles.py') ):
+        logger.error("configure: error: cannot find TeXFiles.py script")
+        sys.exit(1)
+    tfp = cmdOutput("python -tt " + os.path.join(srcdir, 'scripts', 'TeXFiles.py'))
+    logger.info(tfp)
+    logger.info("\tdone")
+
+
 def removeTempFiles():
     # Final clean-up
     if not lyx_keep_temps:
@@ -1332,6 +1343,7 @@ def removeTempFiles():
 
 if __name__ == '__main__':
     lyx_check_config = True
+    lyx_kpsewhich = True
     outfile = 'lyxrc.defaults'
     lyxrc_fileformat = 7
     rc_entries = ''
@@ -1344,10 +1356,13 @@ if __name__ == '__main__':
 Options:
     --help                   show this help lines
     --keep-temps             keep temporary files (for debug. purposes)
+    --without-kpsewhich      do not update TeX files information via kpsewhich
     --without-latex-config   do not run LaTeX to determine configuration
     --with-version-suffix=suffix suffix of binary installed files
 '''
             sys.exit(0)
+        elif op == '--without-kpsewhich':
+            lyx_kpsewhich = False
         elif op == '--without-latex-config':
             lyx_check_config = False
         elif op == '--keep-temps':
@@ -1392,6 +1407,8 @@ Format %i
     if windows_style_tex_paths != '':
         addToRC(r'\tex_expects_windows_paths %s' % windows_style_tex_paths)
     checkOtherEntries()
+    if lyx_kpsewhich:
+        rescanTeXFiles()
     checkModulesConfig()
     # --without-latex-config can disable lyx_check_config
     ret = checkLatexConfig(lyx_check_config and LATEX != '', bool_docbook)

Reply via email to