Only log a message and chmod() when the mode isn't already what we

want it to be.  Log both the old and new mode.
This commit is contained in:
Guido van Rossum 2003-01-29 16:58:31 +00:00
parent 6afc5e02fa
commit d3590f937f
1 changed files with 6 additions and 3 deletions

View 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 ()