mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Keep a copy of output from lib/configure.py to configure.log
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14590 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8d9e8f5097
commit
46212cf492
@ -13,6 +13,24 @@
|
|||||||
import sys, os, re, shutil, glob
|
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):
|
def writeToFile(filename, lines, append = False):
|
||||||
" utility function: write or append lines to filename "
|
" utility function: write or append lines to filename "
|
||||||
if append:
|
if append:
|
||||||
@ -678,6 +696,7 @@ if __name__ == '__main__':
|
|||||||
rc_entries = ''
|
rc_entries = ''
|
||||||
lyx_keep_temps = False
|
lyx_keep_temps = False
|
||||||
version_suffix = ''
|
version_suffix = ''
|
||||||
|
logfile = 'configure.log'
|
||||||
## Parse the command line
|
## Parse the command line
|
||||||
for op in sys.argv[1:]: # default shell/for list is $*, the options
|
for op in sys.argv[1:]: # default shell/for list is $*, the options
|
||||||
if op in [ '-help', '--help', '-h' ]:
|
if op in [ '-help', '--help', '-h' ]:
|
||||||
@ -698,7 +717,11 @@ Options:
|
|||||||
else:
|
else:
|
||||||
print "Unknown option", op
|
print "Unknown option", op
|
||||||
sys.exit(1)
|
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
|
# check if we run from the right directory
|
||||||
srcdir = os.path.dirname(sys.argv[0])
|
srcdir = os.path.dirname(sys.argv[0])
|
||||||
if srcdir == '':
|
if srcdir == '':
|
||||||
|
Loading…
Reference in New Issue
Block a user