Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
6.3.0
-
None
Description
example input
target.extra = printf "'%s'\n" a \"b (c d)\" e INSTALLS += target
problem:
the value is parsed as
[ 'printf', "'%s'\n", 'a', '\\"b', '(', 'c', 'd', ')', '\\"', 'e' ]
note how the braces go to separate tokens. this is because of the BracedValue parser
qmake2cmake's class Scope has the method get_string, which simply does
" ".join(self.get(key)
so now the command is different, because the original whitespace is lost. note the extra whitespace around braces
// actual printf "'%s'\n" a \"b ( c d ) \" e // expected printf "'%s'\n" a \"b (c d)\" e
workaround: use a quoted string in the .pro file
target.extra = "printf \"'%s'\n\" a \"b (c d)\" e" INSTALLS += target
suggested solution
parse the value string so that the original value can be restored with
"".join(self.get(key)
this means:
- keep all whitespace between tokens
- keep quotes around quoted strings
- do zero evaluation in the parser stage (dont decode backslashes)
- in class Scope, the method get will remove whitespace tokens, decode backslash-escapes, unpack quoted strings
i started working on this ...
will push commits to my fork at https://github.com/milahu/qmake2cmake