summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/build_scripts.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-01-29 16:58:31 (GMT)
committerGuido van Rossum <guido@python.org>2003-01-29 16:58:31 (GMT)
commitd3590f937f4493445beeb253e5048771d1663ab7 (patch)
treef4bc7b4b7599c39ee2ee9feeae1d92bfcdb8481b /Lib/distutils/command/build_scripts.py
parent6afc5e02fa775517fa0b6455906a8c203baf9cd2 (diff)
downloadcpython-d3590f937f4493445beeb253e5048771d1663ab7.zip
cpython-d3590f937f4493445beeb253e5048771d1663ab7.tar.gz
cpython-d3590f937f4493445beeb253e5048771d1663ab7.tar.bz2
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.
Diffstat (limited to 'Lib/distutils/command/build_scripts.py')
-rw-r--r--Lib/distutils/command/build_scripts.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
index c7bd4a9..f61ad37 100644
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -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 ()