summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-09-02 14:27:41 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-09-02 23:44:15 +0200
commit067fb7915a469fa83aac60f345cee08db087a587 (patch)
tree5efa50dd00be72e38c65a8f1d1387e0820f34ad1 /util
parent46f8c46bee122d70589e97804a9c98fff6ad494b (diff)
pro2cmake: Fix qmake parser's line continuation handling
The qmake parser of pro2cmake handles completely commented lines to make assignments like this work: SUBDIRS = \ foo \ # bar \ bar However, assignments like SUBDIRS = \ foo \ #bar \ bar were cut off at the commented line. Fix this by allowing leading whitespace for "fully commented lines". Change-Id: Ib5de850a02fd9b9ebb7c056c2f64f9d684334b08 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'util')
-rw-r--r--util/cmake/qmake_parser.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cmake/qmake_parser.py b/util/cmake/qmake_parser.py
index 1b49ac7b58..73620f0890 100644
--- a/util/cmake/qmake_parser.py
+++ b/util/cmake/qmake_parser.py
@@ -54,6 +54,7 @@ def fixup_comments(contents: str) -> str:
# Get rid of completely commented out lines.
# So any line which starts with a '#' char and ends with a new line
# will be replaced by a single new line.
+ # The # may be preceded by any number of spaces or tabs.
#
# This is needed because qmake syntax is weird. In a multi line
# assignment (separated by backslashes and newlines aka
@@ -67,7 +68,7 @@ def fixup_comments(contents: str) -> str:
# care of it as well, as if the commented line didn't exist in the
# first place.
- contents = re.sub(r"\n#[^\n]*?\n", "\n", contents, re.DOTALL)
+ contents = re.sub(r"\n[ \t]*#[^\n]*?\n", "\n", contents, re.DOTALL)
return contents