Hi Georg,
the following patch fixes the handling of gzipped files from lyx2lyx.
The problem is that there isn't any opt.input.name is the file is
gzipped. Is it ok?
I will apply it soon, after launch actually ;-), if no problem shows.
--
Jos� Ab�lio
LyX and docbook, a perfect match. :-)
Index: lyx2lyx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v
retrieving revision 1.25
diff -u -p -r1.25 lyx2lyx
--- lyx2lyx 14 Apr 2004 08:45:46 -0000 1.25
+++ lyx2lyx 3 May 2004 12:16:55 -0000
@@ -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)
Index: lyx_1_4.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx_1_4.py,v
retrieving revision 1.3
diff -u -p -r1.3 lyx_1_4.py
--- lyx_1_4.py 29 Apr 2004 09:24:27 -0000 1.3
+++ lyx_1_4.py 3 May 2004 12:16:55 -0000
@@ -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,