From 357a7731e99fbeb99c5cf759695d57f81155f299 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 30 Jan 2017 15:31:59 +0100 Subject: [PATCH] update-copyright.py: Retain original file mode 2017-01-31 Bernhard Reutner-Fischer * update-copyright.py (Copyright.process_file): Retain original file mode. From-SVN: r245028 --- contrib/ChangeLog | 5 +++++ contrib/update-copyright.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 15e74782076..87dc2337c5d 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2017-01-31 Bernhard Reutner-Fischer + + * update-copyright.py (Copyright.process_file): Retain original + file mode. + 2017-01-29 Gerald Pfeifer * update-copyright.py: Fix the name of this script in examples. diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py index 289ce098f3f..f9852a8544f 100755 --- a/contrib/update-copyright.py +++ b/contrib/update-copyright.py @@ -393,8 +393,10 @@ class Copyright: lines = [] changed = False line_filter = filter.get_line_filter (dir, filename) + mode = None with open (pathname, 'r') as file: prev = None + mode = os.fstat (file.fileno()).st_mode for line in file: while line: next_line = None @@ -421,6 +423,7 @@ class Copyright: with open (tmp_pathname, 'w') as file: for line in lines: file.write (line) + os.fchmod (file.fileno(), mode) if self.use_quilt: subprocess.call (['quilt', 'add', pathname]) os.rename (tmp_pathname, pathname)