mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-04 16:42:57 +00:00
Fix warnings in python 2.3.
Add redirection of log as an option. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8209 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
540b89fcf2
commit
62715f910e
@ -1,3 +1,10 @@
|
|||||||
|
2003-12-05 José Matos <jamatos@lyx.org>
|
||||||
|
|
||||||
|
* error.py:
|
||||||
|
* parser_tools.py: quiet encoding warning in python 2.3.
|
||||||
|
|
||||||
|
* lyx2lyx: add logfile as an option.
|
||||||
|
|
||||||
2003-12-03 José Matos <jamatos@lyx.org>
|
2003-12-03 José Matos <jamatos@lyx.org>
|
||||||
|
|
||||||
* lyx2lyx: update copyright date
|
* lyx2lyx: update copyright date
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# This file is part of lyx2lyx
|
# This file is part of lyx2lyx
|
||||||
# Copyright (C) 2002 José Matos <jamatos@lyx.org>
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
# Copyright (C) 2002-2003 José Matos <jamatos@lyx.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,6 +33,7 @@ opt = struct()
|
|||||||
|
|
||||||
opt.output = sys.stdout
|
opt.output = sys.stdout
|
||||||
opt.input = sys.stdin
|
opt.input = sys.stdin
|
||||||
|
opt.err = sys.stderr
|
||||||
opt.start = None
|
opt.start = None
|
||||||
opt.end = None
|
opt.end = None
|
||||||
opt.quiet = 0
|
opt.quiet = 0
|
||||||
@ -52,6 +53,7 @@ Options:
|
|||||||
-l, --list list all available formats
|
-l, --list list all available formats
|
||||||
-d, --debug level level=0..2 (O_ no debug information,2_verbose)
|
-d, --debug level level=0..2 (O_ no debug information,2_verbose)
|
||||||
default: level=1
|
default: level=1
|
||||||
|
-e, --err error_file name of the error file or else goes to stderr
|
||||||
-f, --from version initial version (optional)
|
-f, --from version initial version (optional)
|
||||||
-t, --to version final version (optional)
|
-t, --to version final version (optional)
|
||||||
-o, --output name name of the output file or else goes to stdout
|
-o, --output name name of the output file or else goes to stdout
|
||||||
@ -59,9 +61,9 @@ Options:
|
|||||||
|
|
||||||
|
|
||||||
def parse_options(argv):
|
def parse_options(argv):
|
||||||
_options = ["help", "version", "list", "debug=", "from=", "to=", "output=", "quiet"]
|
_options = ["help", "version", "list", "debug=", "err=", "from=", "to=", "output=", "quiet"]
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv[1:], "d:f:hlo:qt:v", _options)
|
opts, args = getopt.getopt(argv[1:], "d:e:f:hlo:qt:v", _options)
|
||||||
except getopt.error:
|
except getopt.error:
|
||||||
usage()
|
usage()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -87,6 +89,8 @@ def parse_options(argv):
|
|||||||
opt.start = lyxformat(a)
|
opt.start = lyxformat(a)
|
||||||
if o in ("-t", "--to"):
|
if o in ("-t", "--to"):
|
||||||
opt.end = lyxformat(a)
|
opt.end = lyxformat(a)
|
||||||
|
if o in ("-e","--err"):
|
||||||
|
opt.err = open(a, "w")
|
||||||
|
|
||||||
if not opt.end:
|
if not opt.end:
|
||||||
opt.end = lst_ft[len(lst_ft)-1]
|
opt.end = lst_ft[len(lst_ft)-1]
|
||||||
@ -105,13 +109,13 @@ def lyxformat(fmt):
|
|||||||
if result:
|
if result:
|
||||||
fmt = int(result.group(1) + result.group(2))
|
fmt = int(result.group(1) + result.group(2))
|
||||||
else:
|
else:
|
||||||
sys.stderr.write(str(fmt) + ": " + error.invalid_format)
|
opt.err.write(str(fmt) + ": " + error.invalid_format)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
if fmt in lst_ft:
|
if fmt in lst_ft:
|
||||||
return fmt
|
return fmt
|
||||||
|
|
||||||
sys.stderr.write(fmt + ": " + error.format_not_supported)
|
opt.err.write(fmt + ": " + error.format_not_supported)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def read_file(file, header, body):
|
def read_file(file, header, body):
|
||||||
@ -122,7 +126,7 @@ def read_file(file, header, body):
|
|||||||
while 1:
|
while 1:
|
||||||
line = file.readline()
|
line = file.readline()
|
||||||
if not line:
|
if not line:
|
||||||
sys.stderr.write(error.invalid_file)
|
opt.err.write(error.invalid_file)
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
line = line[:-1]
|
line = line[:-1]
|
||||||
@ -149,7 +153,7 @@ def read_file(file, header, body):
|
|||||||
body.append(line[:-1])
|
body.append(line[:-1])
|
||||||
|
|
||||||
if not fmt:
|
if not fmt:
|
||||||
sys.stderr.write(error.invalid_file)
|
opt.err.write(error.invalid_file)
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
return fmt
|
return fmt
|
||||||
|
|
||||||
@ -168,7 +172,7 @@ def main(argv):
|
|||||||
|
|
||||||
if opt.start:
|
if opt.start:
|
||||||
if opt.start != fmt:
|
if opt.start != fmt:
|
||||||
sys.stderr.write("%s: %s %s\n" % (warning.dont_match, opt.start, fmt))
|
opt.err.write("%s: %s %s\n" % (warning.dont_match, opt.start, fmt))
|
||||||
else:
|
else:
|
||||||
opt.start = fmt
|
opt.start = fmt
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# This file is part of lyx2lyx
|
# This file is part of lyx2lyx
|
||||||
# Copyright (C) 2002 Dekel Tsur <dekel@lyx.org>, José Matos <jamatos@lyx.org>
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
# Copyright (C) 2002-2003 Dekel Tsur <dekel@lyx.org>, José Matos <jamatos@lyx.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
Loading…
Reference in New Issue
Block a user