From f6dbef59e6095fbf0a63a0d6a5c285763214b628 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 9 Aug 2006 15:27:12 +0000 Subject: [PATCH] Keep a copy of output from lib/configure.py to configure.log git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@14591 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 5 +++++ lib/configure.py | 25 ++++++++++++++++++++++++- status.14x | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 1463c56e8d..29ac5eec4c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2006-08-08 Bo Peng + + * configure.py: Keep a copy of the output of configure.py to a log + file configure.log. + 2006-08-09 Jean-Marc Lasgouttes * configure.py: fix the header of lyxrc.defaults. diff --git a/lib/configure.py b/lib/configure.py index 0f4fc2c8fd..f6914e433b 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -13,6 +13,24 @@ 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: @@ -662,6 +680,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' ]: @@ -682,7 +701,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 == '': diff --git a/status.14x b/status.14x index ec170bdfd8..a93ff06d21 100644 --- a/status.14x +++ b/status.14x @@ -64,6 +64,8 @@ What's new - Display latex package checking results faster during configuration. +- Log the output of configure.py to a log file configure.log. + - Change the encoding of some python scripts from iso-8859-15 to iso-8859-1. The former causes problems with embedded python.