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 6b5a7116cd)
This commit is contained in:
Richard Heck 2018-02-01 21:58:29 -05:00
parent 4fc0f3e754
commit 42718b1dbd

View 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: