From: José Matox Date: Mon, 3 May 2004 13:40:12 +0000 (+0000) Subject: fix handling of gzipped files, move default warning level to 1 X-Git-Tag: 1.6.10~15250 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=17ec2aa0615913d8c9f3b36e133f302b287346a0;p=features.git fix handling of gzipped files, move default warning level to 1 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8725 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index f9984032cb..68fa99d36b 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,10 @@ +2004-05-03 José Matos + + * lyx_1_4.py (convert_graphics): + * lyx2lyx: introduce new member of the structure class, dir which + carries the directory of the converted file. + * lyx2lyx: move default warning level to 1. + 2004-04-29 Georg Baum * lyx_1_4.py (convert_graphics): new, convert graphics filenames diff --git a/lib/lyx2lyx/lyx2lyx b/lib/lyx2lyx/lyx2lyx index b96af09b11..ffe36e893c 100755 --- a/lib/lyx2lyx/lyx2lyx +++ b/lib/lyx2lyx/lyx2lyx @@ -19,6 +19,7 @@ import getopt import gzip import sys +import os.path from parser_tools import read_file, write_file, read_version, set_version, \ read_format, set_format, chain, lyxformat, get_value @@ -30,10 +31,11 @@ class struct: self.input = sys.stdin self.err = sys.stderr self.debug = 1 + self.dir = "" self.start = None self.end = None - def warning(self, message, debug_level= 10): + def warning(self, message, debug_level= 1): if debug_level <= self.debug: self.err.write(message + "\n") @@ -94,6 +96,7 @@ def parse_options(argv, version, opt): if args: file = args[0] + opt.dir = os.path.dirname(os.path.abspath(file)) try: gzip.open(file).readline() opt.output = gzip.GzipFile("","wb",6,opt.output) diff --git a/lib/lyx2lyx/lyx_1_4.py b/lib/lyx2lyx/lyx_1_4.py index 058d3e9f7b..50a42c468e 100644 --- a/lib/lyx2lyx/lyx_1_4.py +++ b/lib/lyx2lyx/lyx_1_4.py @@ -1121,10 +1121,6 @@ def revert_float(lines, opt): def convert_graphics(lines, opt): """ Add extension to filenames of insetgraphics if necessary. """ - if opt.input == stdin: - dir = "" - else: - dir = os.path.dirname(os.path.abspath(opt.input.name)) i = 0 while 1: i = find_token(lines, "\\begin_inset Graphics", i) @@ -1136,7 +1132,7 @@ def convert_graphics(lines, opt): return i = i + 1 filename = split(lines[j])[1] - absname = os.path.normpath(os.path.join(dir, filename)) + absname = os.path.normpath(os.path.join(opt.dir, filename)) if opt.input == stdin and not os.path.isabs(filename): # We don't know the directory and cannot check the file. # We could use a heuristic and take the current directory,