diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-14 11:28:28 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-14 11:29:41 +0100 |
| commit | 6a26a1371cfaa84b6cb664d4b48b102fcb4a7996 (patch) | |
| tree | a56a2dc0ae8e58af525466ac804074084b43f8dd /kconfiglib.py | |
| parent | 91d9c7cb3f27bcb9ddf0111ec0589b14c79f101d (diff) | |
Make _comment() preserve trailing newlines.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index c6d2a07..fa98855 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -3644,10 +3644,13 @@ def _sep_lines(*args): return "\n".join(args) def _comment(s): - """Returns a new string with "# " inserted before each line in 's'.""" + """Returns a new string with "#" inserted before each line in 's'.""" if not s: return "#" - return "\n".join(["#" + line for line in s.splitlines()]) + res = "".join(["#" + line for line in s.splitlines(True)]) + if s.endswith("\n"): + return res + "#" + return res def _get_lines(filename): """Returns a list of lines from 'filename', joining any line ending in \\ |
