Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c91c81

Browse files
committed
Patch #409504: Fix regex problems, consider \-continuation lines in Makefile
and Setup.
1 parent 55f826c commit 2c91c81

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

Tools/freeze/makeconfig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def makeconfig(infp, outfp, modules, with_ifdef=0):
1212
line = infp.readline()
1313
if not line: break
1414
outfp.write(line)
15-
if m1 and m1.search(line) >= 0:
15+
if m1 and m1.search(line):
1616
m1 = None
1717
for mod in modules:
1818
if mod in never:
@@ -22,7 +22,7 @@ def makeconfig(infp, outfp, modules, with_ifdef=0):
2222
outfp.write('extern void init%s();\n' % mod)
2323
if with_ifdef:
2424
outfp.write("#endif\n")
25-
elif m2 and m2.search(line) >= 0:
25+
elif m2 and m2.search(line):
2626
m2 = None
2727
for mod in modules:
2828
if mod in never:

Tools/freeze/parsesetup.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@
1313
def getmakevars(filename):
1414
variables = {}
1515
fp = open(filename)
16+
pendingline = ""
1617
try:
1718
while 1:
1819
line = fp.readline()
20+
if pendingline:
21+
line = pendingline + line
22+
pendingline = ""
1923
if not line:
2024
break
25+
if line.endswith('\\\n'):
26+
pendingline = line[:-2]
2127
matchobj = makevardef.match(line)
2228
if not matchobj:
2329
continue
@@ -44,15 +50,22 @@ def getsetupinfo(filename):
4450
modules = {}
4551
variables = {}
4652
fp = open(filename)
53+
pendingline = ""
4754
try:
4855
while 1:
4956
line = fp.readline()
57+
if pendingline:
58+
line = pendingline + line
59+
pendingline = ""
5060
if not line:
5161
break
5262
# Strip comments
5363
i = string.find(line, '#')
5464
if i >= 0:
5565
line = line[:i]
66+
if line.endswith('\\\n'):
67+
pendingline = line[:-2]
68+
continue
5669
matchobj = setupvardef.match(line)
5770
if matchobj:
5871
(name, value) = matchobj.group(1, 2)

0 commit comments

Comments
 (0)