]> git.lyx.org Git - features.git/commitdiff
fix handling of gzipped files, move default warning level to 1
authorJosé Matox <jamatos@lyx.org>
Mon, 3 May 2004 13:40:12 +0000 (13:40 +0000)
committerJosé Matox <jamatos@lyx.org>
Mon, 3 May 2004 13:40:12 +0000 (13:40 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8725 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/ChangeLog
lib/lyx2lyx/lyx2lyx
lib/lyx2lyx/lyx_1_4.py

index f9984032cbfaa5a6f14d035b3926a681982789fb..68fa99d36bab51e245c04232b1178cb7dd931f81 100644 (file)
@@ -1,3 +1,10 @@
+2004-05-03  José Matos  <jamatos@lyx.org>
+
+       * 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  <Georg.Baum@post.rwth-aachen.de>
 
        * lyx_1_4.py (convert_graphics): new, convert graphics filenames
index b96af09b11142b418cf4fceeff2a524157e0f302..ffe36e893c2220bf4a3804f4e54d540688e8a08d 100755 (executable)
@@ -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 058d3e9f7b14115a833236c15007523615984e63..50a42c468e3a1ce53310da9a4ab9e9abe60de05c 100644 (file)
@@ -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,