]> granicus.if.org Git - python/commitdiff
Only log a message and chmod() when the mode isn't already what we
authorGuido van Rossum <guido@python.org>
Wed, 29 Jan 2003 16:58:31 +0000 (16:58 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 29 Jan 2003 16:58:31 +0000 (16:58 +0000)
want it to be.  Log both the old and new mode.

Lib/distutils/command/build_scripts.py

index c7bd4a9d9b10ef190eb2696c560bd51c06dcb2da..f61ad37d03c81c04fd6d5e69cdd0f59e4ee860d6 100644 (file)
@@ -114,9 +114,12 @@ class build_scripts (Command):
                 if self.dry_run:
                     log.info("changing mode of %s", file)
                 else:
-                    mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777
-                    log.info("changing mode of %s to %o", file, mode)
-                    os.chmod(file, mode)
+                    oldmode = os.stat(file)[ST_MODE] & 07777
+                    newmode = (oldmode | 0555) & 07777
+                    if newmode != oldmode:
+                        log.info("changing mode of %s from %o to %o",
+                                 file, oldmode, newmode)
+                        os.chmod(file, newmode)
 
     # copy_scripts ()