]> git.lyx.org Git - lyx.git/blobdiff - lib/configure.py
Add language and encoding information
[lyx.git] / lib / configure.py
index 0ab15c7a800f69614f165bc8f2c2ee1c5fb068a2..af20febd5e1e1af964ce866cfa3b9b17c250fb79 100644 (file)
 import sys, os, re, shutil, glob
 
 
+class Tee:
+    ''' Writing to a Tee object will write to all file objects it keeps.
+        That is to say, writing to Tee(sys.stdout, open(logfile, 'w')) will
+        write to sys.stdout as well as a log file.
+    '''
+    def __init__(self, *args):
+        self.files = args
+
+    def write(self, data):
+        for f in self.files:
+            result = f.write(data)
+        return result
+
+    def writelines(self, seq):
+        for i in seq:
+            self.write(i)
+
+
 def writeToFile(filename, lines, append = False):
     " utility function: write or append lines to filename "
     if append:
@@ -508,7 +526,7 @@ def checkLatexConfig(check_config, bool_docbook, bool_linuxdoc):
 # This file declares layouts and their associated definition files
 # (include dir. relative to the place where this file is).
 # It contains only default values, since chkconfig.ltx could not be run
-# for some reason. Run ./configure if you need to update it after a
+# for some reason. Run ./configure.py if you need to update it after a
 # configuration change.
 ''')
         # build the list of available layout files and convert it to commands
@@ -603,7 +621,7 @@ def createLaTeXConfig():
         writeToFile('packages.lst', '''
 ### This file should contain the list of LaTeX packages that have been
 ### recognized by LyX. Unfortunately, since configure could not find
-### your LaTeX2e program, the tests have not been run. Run ./configure
+### your LaTeX2e program, the tests have not been run. Run ./configure.py
 ### if you need to update it after a configuration change.
 ''')
     print 'creating doc/LaTeXConfig.lyx'
@@ -678,6 +696,7 @@ if __name__ == '__main__':
     rc_entries = ''
     lyx_keep_temps = False
     version_suffix = ''
+    logfile = 'configure.log'
     ## Parse the command line
     for op in sys.argv[1:]:   # default shell/for list is $*, the options
         if op in [ '-help', '--help', '-h' ]:
@@ -698,7 +717,11 @@ Options:
         else:
             print "Unknown option", op
             sys.exit(1)
-    #    
+    #
+    # set up log file for stdout and stderr
+    log = open(logfile, 'w')
+    sys.stdout = Tee(sys.stdout, log)
+    sys.stderr = Tee(sys.stderr, log)
     # check if we run from the right directory
     srcdir = os.path.dirname(sys.argv[0])
     if srcdir == '':
@@ -713,8 +736,8 @@ Options:
     writeToFile(outfile, '''# This file has been automatically generated by LyX' lib/configure.py
 # script. It contains default settings that have been determined by
 # examining your system. PLEASE DO NOT MODIFY ANYTHING HERE! If you
-# want to customize LyX, make a copy of the file LYXDIR/lyxrc as
-# ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
+# want to customize LyX, use LyX' Preferences dialog or modify directly 
+# the "preferences" file instead. Any setting in that file will
 # override the values given here.
 ''')
     # check latex