]> git.lyx.org Git - features.git/commitdiff
Double escape binary regex in lyx2lyx and fix line-ending problem.
authorRichard Heck <rgheck@lyx.org>
Fri, 2 Feb 2018 02:58:29 +0000 (21:58 -0500)
committerRichard Heck <rgheck@lyx.org>
Fri, 2 Feb 2018 04:33:37 +0000 (23:33 -0500)
When we switched from r'...' to b'...', this required strings used
as input to re.compile to be double-escaped. It's not an issue with
"\s", because "\s" has no special meaning in a string.

Also, printing in binary mode did not output a line ending.

(cherry picked from commit 6b5a7116cd6697d1121a5ffb76d54102a8e265ba)

lib/configure.py

index 95203fcb6ea0628474806abc3d13090cfdab750d..bfa48525b2243016c49887144a36547599022a62 100644 (file)
@@ -1285,8 +1285,8 @@ def processLayoutFile(file, bool_docbook):
             return x.strip()
     classname = file.split(os.sep)[-1].split('.')[0]
     # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
-    p = re.compile(b'^\s*#\s*\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
-    q = re.compile(b'^\s*#\s*\\DeclareCategory{(.*)}\s*$')
+    p = re.compile(b'^\s*#\s*\\\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
+    q = re.compile(b'^\s*#\s*\\\\DeclareCategory{(.*)}\s*$')
     classdeclaration = b""
     categorydeclaration = b'""'
     for line in open(file, 'rb').readlines():
@@ -1359,7 +1359,7 @@ def checkLatexConfig(check_config, bool_docbook):
                 foundClasses.append(cleanclass)
                 retval = processLayoutFile(file, bool_docbook)
                 if retval != b"":
-                    tx.write(retval)
+                    tx.write(retval + os.linesep)
         tx.close()
         logger.info('\tdone')
     if not os.path.isfile('packages.lst') or not check_config: