From 42718b1dbd7d5fe6ef6521fb3b87f405b72d1df8 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 1 Feb 2018 21:58:29 -0500 Subject: [PATCH] Double escape binary regex in lyx2lyx and fix line-ending problem. 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/configure.py b/lib/configure.py index 95203fcb6e..bfa48525b2 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -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: