* [PATCH] contrib: ignore CR in update-copyright.py
@ 2023-01-17 12:00 Martin Liška
2023-03-11 16:20 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2023-01-17 12:00 UTC (permalink / raw)
To: gcc-patches; +Cc: Jakub Jelinek
When opening files, preserve CR characters. By default, open
accepts universal newlines, but I think we should only split with '\n'.
Ready to be installed?
Thanks,
Martin
contrib/ChangeLog:
* update-copyright.py: Split lines only with '\n'.
---
contrib/update-copyright.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py
index ac7a94743cf..bdb5417bcec 100755
--- a/contrib/update-copyright.py
+++ b/contrib/update-copyright.py
@@ -408,7 +408,7 @@ class Copyright:
line_filter = filter.get_line_filter (dir, filename)
mode = None
encoding = self.guess_encoding(pathname)
- with open (pathname, 'r', encoding=encoding) as file:
+ with open (pathname, 'r', encoding=encoding, newline='\n') as file:
prev = None
mode = os.fstat (file.fileno()).st_mode
for line in file:
@@ -434,7 +434,7 @@ class Copyright:
# If something changed, write the new file out.
if changed and self.errors.ok():
tmp_pathname = pathname + '.tmp'
- with open (tmp_pathname, 'w', encoding=encoding) as file:
+ with open (tmp_pathname, 'w', encoding=encoding, newline='\n') as file:
for line in lines:
file.write (line)
os.fchmod (file.fileno(), mode)
--
2.39.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] contrib: ignore CR in update-copyright.py
2023-01-17 12:00 [PATCH] contrib: ignore CR in update-copyright.py Martin Liška
@ 2023-03-11 16:20 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-03-11 16:20 UTC (permalink / raw)
To: Martin Liška, gcc-patches; +Cc: Jakub Jelinek
On 1/17/23 05:00, Martin Liška wrote:
> When opening files, preserve CR characters. By default, open
> accepts universal newlines, but I think we should only split with '\n'.
>
> Ready to be installed?
> Thanks,
> Martin
>
> contrib/ChangeLog:
>
> * update-copyright.py: Split lines only with '\n'.
OK.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-11 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 12:00 [PATCH] contrib: ignore CR in update-copyright.py Martin Liška
2023-03-11 16:20 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).