aboutsummaryrefslogtreecommitdiff
path: root/contrib/update-copyright.py
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>2017-01-30 15:31:59 +0100
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>2017-01-30 15:31:59 +0100
commit357a7731e99fbeb99c5cf759695d57f81155f299 (patch)
tree0c7970b92a2469bcd44a16460ec8b6a0266f1fe6 /contrib/update-copyright.py
parent24fc4dd899b79a8e2f30e5088bd9fcea34d99923 (diff)
downloadgcc-357a7731e99fbeb99c5cf759695d57f81155f299.zip
gcc-357a7731e99fbeb99c5cf759695d57f81155f299.tar.gz
gcc-357a7731e99fbeb99c5cf759695d57f81155f299.tar.bz2
update-copyright.py: Retain original file mode
2017-01-31 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * update-copyright.py (Copyright.process_file): Retain original file mode. From-SVN: r245028
Diffstat (limited to 'contrib/update-copyright.py')
-rwxr-xr-xcontrib/update-copyright.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py
index 289ce09..f9852a8 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)